[ 
https://issues.apache.org/jira/browse/CLIMATE-822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15360677#comment-15360677
 ] 

Alex Goodman commented on CLIMATE-822:
--------------------------------------

What exactly do you mean by valid data? If you are trying to check if the 
masked array contains all zeroes, you should do the following to prove so 
rather than just relying on print directly:

{code}
(results==0).all()
{code}

or check the maxes and mins:

{code}
results.max()
results.min()
{code}

Either way the issue here is that if no contour levels are given to 
{{plotter.draw_contour_map()}} then default levels are derived from the range 
of the data, which would mean fewer than two contour levels are generated if 
the results array has all zeroes. That would suggest either the the evaluation 
is being calculated improperly (since the two datasets entered into the 
evaluation are not identical), the input arguments are not being fed correctly, 
or the desired evaluation result isn't being accessed. If of course you do find 
that there are nonzero values in the results array then the issue is indeed in 
plotter.

> ValueError in RCMES test
> ------------------------
>
>                 Key: CLIMATE-822
>                 URL: https://issues.apache.org/jira/browse/CLIMATE-822
>             Project: Apache Open Climate Workbench
>          Issue Type: Bug
>            Reporter: Ibrahim Jarif
>            Priority: Critical
>             Fix For: 1.1
>
>
> {code}
> test[smoke*] % python test.py 
> Loading AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc into an 
> OCW Dataset Object
> KNMI_Dataset.values shape: (times, lats, lons) - (240, 201, 194) 
> Working with the rcmed interface to get CRU3.1 Daily-Max Temp
> We are going to use the Model to constrain the Spatial Domain
> The KNMI_Dataset spatial bounds (min_lat, max_lat, min_lon, max_lon) are: 
> (-45.7599983215332, 42.2400016784668, -24.639999389648438, 60.279998779296875)
> The KNMI_Dataset spatial resolution (lat_resolution, lon_resolution) is: 
> (0.43999863, 0.44000053)
> Calculating the Maximum Overlap in Time for the datasets
> Overlap computed to be: 1989-01-01 to 2008-12-01
> We are going to grab the first 3 year(s) of data
> Final Overlap is: 1989-01-01 to 1992-01-01
> Fetching data from RCMED...
> CRU31_Dataset.values shape: (times, lats, lons) - (37, 176, 170)
> KNMI_Dataset.values shape: (times, lats, lons) - (240, 201, 194)
> Our two datasets have a mis-match in time. We will subset on time to 3 years
> CRU31_Dataset.values shape: (times, lats, lons) - (37, 176, 170)
> KNMI_Dataset.values shape: (times, lats, lons) - (37, 201, 194) 
> Temporally Rebinning the Datasets to a Single Timestep
> KNMI_Dataset.values shape: (201, 194)
> CRU31_Dataset.values shape: (176, 170) 
> Spatially Regridding the KNMI_Dataset...
> Spatially Regridding the CRU31_Dataset...
> Final shape of the KNMI_Dataset:(1, 176, 170)
> Final shape of the CRU31_Dataset:(1, 176, 170)
> Setting up a Bias metric to use for evaluation
> Making the Evaluation definition
> Executing the Evaluation using the object's run() method
> Accessing the Results of the Evaluation run
> Generating a contour map using ocw.plotter.draw_contour_map()
> Traceback (most recent call last):
>   File "test.py", line 179, in <module>
>     subtitles=sub_titles)
>   File "/home/ibrahim/Desktop/climate/ocw/plotter.py", line 716, in 
> draw_contour_map
>     cs = m.contourf(x, y, data, cmap=cmap, levels=clevs, extend=extend)
>   File 
> "/home/ibrahim/miniconda2/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py",
>  line 521, in with_transform
>     return plotfunc(self,x,y,data,*args,**kwargs)
>   File 
> "/home/ibrahim/miniconda2/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py",
>  line 3673, in contourf
>     CS = ax.contourf(x,y,data,*args,**kwargs)
>   File 
> "/home/ibrahim/miniconda2/lib/python2.7/site-packages/matplotlib/__init__.py",
>  line 1812, in inner
>     return func(ax, *args, **kwargs)
>   File 
> "/home/ibrahim/miniconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.py",
>  line 5652, in contourf
>     return mcontour.QuadContourSet(self, *args, **kwargs)
>   File 
> "/home/ibrahim/miniconda2/lib/python2.7/site-packages/matplotlib/contour.py", 
> line 1424, in __init__
>     ContourSet.__init__(self, ax, *args, **kwargs)
>   File 
> "/home/ibrahim/miniconda2/lib/python2.7/site-packages/matplotlib/contour.py", 
> line 863, in __init__
>     self._process_args(*args, **kwargs)
>   File 
> "/home/ibrahim/miniconda2/lib/python2.7/site-packages/matplotlib/contour.py", 
> line 1445, in _process_args
>     x, y, z = self._contour_args(args, kwargs)
>   File 
> "/home/ibrahim/miniconda2/lib/python2.7/site-packages/matplotlib/contour.py", 
> line 1540, in _contour_args
>     self._contour_level_args(z, args)
>   File 
> "/home/ibrahim/miniconda2/lib/python2.7/site-packages/matplotlib/contour.py", 
> line 1183, in _contour_level_args
>     raise ValueError("Filled contours require at least 2 levels.")
> ValueError: Filled contours require at least 2 levels.
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to