Skip to content

Contours colored wrong when data has a wide range #851

@painter1

Description

@painter1

To reproduce this bug you will need a file I have named tmp_AODVIS.nc. Please let me know how to supply it.
This file has one variable on a 180x360 lat-lon grid. The variable's values are mostly in the correct range, between 0 and 1. But about 1/8 of the values are very large, around 1.0e35 (they differ from the fill value and from each other, and they are not masked). This situation arises from an error, but that makes it all the more important that we plot it correctly - so as to reveal the error. (BTW, I didn't do it!)

In fact, the following (reasonable) Python code produces a plot of a uniform color (orange in my case) which implies that all values are between 1.0 and 1.5. As the following code will demonstrate, 88% of the data is less than 1.0

import vcs
v=vcs.init()
f=cdms2.open('tmp_AODVIS.nc')
AOD=f('rv_AODVIS_ANN_ft0_ne30')
gm=v.createisofill()
PROJECTION = v.createprojection()
PROJECTION.type=-1
gm.projection=PROJECTION
levels=vcs.mkscale(0,1.0e10)
levels = [-1,0,0.5,1.0,1.5,2.0,100.0,1.0e36]
gm.levels = levels
v.plot( AOD, gm )

You see a uniform orange, meaning that all data is between 1.0 and 1.5.

It it? No, as demonstrated by:

(AOD<1.0).sum()
56861
(AOD>=1.0).sum()
7939
AOD.shape
(180, 360)
180*360
64800
5861+7939
13800
56861./64800
0.8774845679012345

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions