CDAT / cdms

8 stars 10 forks source link

The attributes' dictionary of a cdms2 variable has a spurious 'name' key #426

Open jypeter opened 3 years ago

jypeter commented 3 years ago

I have just noticed a strange 'name': 'variable_2' key in the attributes dic of a variable. I'm still using cdms2 from CDAT 8.0

The clt variable has no name attribute in the input file (when using ncdump -h clt.nc). And this attribute does not appear when using var.info(). See example below


>>> import cdat_info
>>> file_in=cdms2.open(cdat_info.get_sampledata_path()+"/clt.nc")
>>> file_in.id
'/home/share/unix_files/cdat/miniconda3/envs/cdatm_py3/share/cdat/sample_data/cl   t.nc'
>>> var_in = file_in('clt')

>>> var_in.attributes
{'name': 'variable_2', 'tileIndex': None, 'comments': 'YONU_AMIP1', 'long_name':    'Total cloudiness', 'units': '%', 'grid_name': 'YONU4X5', 'grid_type': 'gaussia   n', 'time_statistic': 'average'}

>>> var_in.info()
*** Description of Slab clt ***
id: clt
shape: (120, 46, 72)
filename:
missing_value: 1e+20
comments: YONU_AMIP1
grid_name: YONU4X5
grid_type: gaussian
time_statistic: average
long_name: Total cloudiness
units: %
tileIndex: None
Grid has Python id 0x2b9a4bcc2630.
Gridtype: generic
Grid shape: (46, 72)
Order: yx
** Dimension 1 **
   id: time
   Designated a time axis.
   units:  months since 1979-1-1 0
   Length: 120
   First:  0.0
   Last:   119.0
   Other axis attributes:
      axis: T
      calendar: gregorian
      realtopology: linear
   Python id:  0x2b9a4bcc2e48
** Dimension 2 **
   id: latitude
   Designated a latitude axis.
   units:  degrees_north
   Length: 46
   First:  -90.0
   Last:   90.0
   Other axis attributes:
      axis: Y
      long_name: Latitude
      realtopology: linear
   Python id:  0x2b9a4bcc24a8
** Dimension 3 **
   id: longitude
   Designated a longitude axis.
   units:  degrees_east
   Length: 72
   First:  -180.0
   Last:   175.0
   Other axis attributes:
      axis: X
      modulo: 360.0
      topology: circular
      long_name: Longitude
      realtopology: circular
   Python id:  0x2b9a4bcc29e8
*** End of description for clt ***
>>> cdat_info.Version
'8.0'