vcs icon indicating copy to clipboard operation
vcs copied to clipboard

Problems with 0.5 to -0.5 longitude grids

Open durack1 opened this issue 7 years ago • 0 comments

I've just tried to plot up a variable using vcs and it appears to fall over with the longitude values which extend from

Out[13]: 
array([   0.5,    1.5,    2.5,    3.5,    4.5,    5.5,    6.5,    7.5,
...
         -7.5,   -6.5,   -5.5,   -4.5,   -3.5,   -2.5,   -1.5,   -0.5], dtype=float32)

The file plotted in vcs looks like: 171116_to Whereas in ferret (admittedly correcting the plot colour ranges to deal with the badly defined missing values) it looks like: 171116_to-ferret

The example script to reproduce this (in vcs) is:

import os,vcs
import cdms2 as cdm

In [4]: fH = cdm.open('171116_to.nc')
In [5]: to = fH('to')
In [6]: to
Out[6]: 
to
masked_array(data =
 [[ 0.28999999  0.361       0.421      ..., -0.033       0.109       0.228     ]
 [ 0.27900001  0.331       0.377      ..., -0.009       0.103       0.20299999]
 [ 0.30000001  0.32499999  0.35600001 ...,  0.111       0.16599999  0.223     ]
 ..., 
 [ 4.70300007  4.96600008  5.19299984 ...,  4.25600004  4.65100002
   5.01399994]
 [ 3.69400001  3.95499992  4.19299984 ...,  3.70600009  4.0710001
   4.40399981]
 [ 2.33699989  2.60899997  2.88000011 ...,  2.78200006  3.10800004
   3.41199994]],
             mask =
 False,
       fill_value = 1e+20)
In [7]: x = vcs.init(bg=True,geometry=(800,600))
In [8]: x.plot(to)
/export/durack1/anaconda2/envs/uvcdat2120/lib/python2.7/site-packages/numpy/ma/core.py:6385: MaskedArrayFutureWarning: In the future the default for ma.maximum.reduce will be axis=0, not the current None, to match np.maximum.reduce. Explicitly pass 0 or None to silence this warning.
  return self.reduce(a)
/export/durack1/anaconda2/envs/uvcdat2120/lib/python2.7/site-packages/numpy/ma/core.py:6385: MaskedArrayFutureWarning: In the future the default for ma.minimum.reduce will be axis=0, not the current None, to match np.minimum.reduce. Explicitly pass 0 or None to silence this warning.
  return self.reduce(a)
Out[9]: 
In [9]: x.png('171116_to.png')
In [10]: to.getGrid()
Out[10]: 
Grid has Python id 0x7f368ff66d10.
Gridtype: generic
Grid shape: (132, 360)
Order: yx

The file and data required is attached below 171116_to.nc.zip

@doutriaux1 ping

durack1 avatar Nov 16 '17 17:11 durack1