Skip to content

cdutil.ANNUALCYCLE.climatology fails with "months since *" time axis #20

Open
@durack1

Description

@durack1

In a file that I downloaded, the time axis looks like:

netcdf argo_2005-2017_grd {                                                                                   
dimensions:                                                                                                   
        LONGITUDE = 360 ;                                                                                     
        LATITUDE = 180 ;                                                                                      
        LEVEL = 27 ;                                                                                          
        TIME = UNLIMITED ; // (150 currently)                                                                 
variables:                                                                                                    
...
        float TIME(TIME) ;
                TIME:units = "months since 2005-01-15" ;
                TIME:title = "Months in Monthly Means" ;
                TIME:long_name = "Months in Monthly Means" ;
                TIME:axis = "T" ;
...

When attempting to use cdutil.ANNUALCYCLE.climatology I get the following error:

import cdms2, cdutil
f = 'argo_2005-2017_grd.nc'
fH = cdms2.open(f)
t = fH('PTEMP',time=('2005','2017'))
# Calculate annualCycle climatology
tAnClim = cdutil.ANNUALCYCLE.climatology(t)

Traceback (most recent call last):                                                             
  File "makeObsClims.py", line 56, in <module>                                                 
    tAnClim = cdu.ANNUALCYCLE.climatology(t)                                                   
  File "/export/duro/anaconda2/envs/uvcdat2120/lib/python2.7/site-packages/cdutil/times.py", line 1451, in climatology
    tmp = TimeSlicer.get(self,slab,self.seasons[i],criteriaarg,statusbar=statusbar,weights=True,sum=sum)                 
  File "/export/duro/anaconda2/envs/uvcdat2120/lib/python2.7/site-packages/cdutil/times.py", line 433, in get         
    slices,bounds,norm=self.slicer(tim,slicerarg)                                                                        
  File "/export/duro/anaconda2/envs/uvcdat2120/lib/python2.7/site-packages/cdutil/times.py", line 680, in monthBasedSlicer
    b0=cdtime.reltime(bnds[i][0],units)                                                                                      
TypeError: 'NoneType' object has no attribute '__getitem__'

@dnadeau4 @doutriaux1

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugBug in the software

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions