Skip to content

cdms2.setAutoBounds('off') problem (OK with 'on') #98

Open
@jypeter

Description

@jypeter

@dnadeau4 and @doutriaux1 I'm using 2.8.0 and if I run the script at the end of this issue with the setAutoBounds line commented out, it works fine. But when the line is not commented, I get the following exception:

Processing year 1851 Tue Feb 28 17:23:05 2017
  Opening http://portal.nersc.gov/pydap/20C_Reanalysis_version2c_ensemble/first_guess.derived/t2m/t2m_1851.daily.nc
Traceback (most recent call last):
  File "/home/users/jypeter/CDAT/Progs/Devel/carmen/download_NERSC_data.py", line 36, in <module>
    longitude=longitude_range)
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/cdms2/cudsinterface.py", line 33, in __call__
    return v(*args, **kwargs)
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/cdms2/avariable.py", line 162, in __call__
    grid=grid)
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/cdms2/selectors.py", line 176, in unmodified_select
    fetched = result.subRegion(*specifications)
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/cdms2/avariable.py", line 931, in subRegion
    b = axis.getBounds(isGeneric) - delta_beg_wrap_dimvalue
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'

If I specify 'on' instead of 'off', it works fine as well...

Can you check what's wrong? Thanks!

#!/usr/bin/env python

import time
import cdms2

var_name = 't2m'

time_select = slice(0, 1) # First time step
ensemble_select = slice(0, 1) # First member
#ensemble_select = slice(None, None) # ALL members
latitude_range = (22, 70)
longitude_range = (-80, 50)

year_start, year_end = 1851, 1853

download_url = 'http://portal.nersc.gov/pydap/20C_Reanalysis_version2c_ensemble/first_guess.derived'
save_path = '/home/scratch01/jypeter'

# Write NetCDF3 Classic
value = 0
cdms2.setNetcdfShuffleFlag(value) ## where value is either 0 or 1
cdms2.setNetcdfDeflateFlag(value) ## where value is either 0 or 1
cdms2.setNetcdfDeflateLevelFlag(value) ## where value is a integer between 0 and 9 included

cdms2.setAutoBounds('off')

for year in range(year_start, year_end + 1):
    print "Processing year", year, time.asctime()
    path_in = '%s/%s/%s_%i.daily.nc' % (download_url, var_name, var_name, year)
    print "  Opening", path_in
    f_in = cdms2.open(path_in)
    var_dap = f_in(var_name,
                   time=time_select,
                   ensemble_member=ensemble_select,
                   latitude=latitude_range,
                   longitude=longitude_range)
    f_in.close()

    path_out = '%s/%s_%i.extracted.daily.nc' % (save_path, var_name, year)
    f_out = cdms2.open(path_out, 'w')
    f_out.history = 'Data extracted by John Doe from %s' % (path_in,)
    f_out.write(var_dap)
    f_out.close()

# The end

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions