New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

jypeter opened this Issue Feb 28, 2017 · 2 comments


None yet
3 participants

jypeter commented Feb 28, 2017

@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
Traceback (most recent call last):
  File "/home/users/jypeter/CDAT/Progs/Devel/carmen/", line 36, in <module>
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/cdms2/", line 33, in __call__
    return v(*args, **kwargs)
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/cdms2/", line 162, in __call__
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/cdms2/", line 176, in unmodified_select
    fetched = result.subRegion(*specifications)
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/cdms2/", 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 = ''
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


for year in range(year_start, year_end + 1):
    print "Processing year", year, time.asctime()
    path_in = '%s/%s/' % (download_url, var_name, var_name, year)
    print "  Opening", path_in
    f_in =
    var_dap = f_in(var_name,

    path_out = '%s/' % (save_path, var_name, year)
    f_out =, 'w')
    f_out.history = 'Data extracted by John Doe from %s' % (path_in,)

# The end

This comment has been minimized.


doutriaux1 commented Feb 28, 2017

hum... the default is 2 which means no autobounds except for lat/lon


This comment has been minimized.


dnadeau4 commented Mar 2, 2017

@jypeter netcdf4 is normal by default, you need to set netcdf3 flags. cdms2.setNetcdf4Flag`

For the autobounds, this seems to be a numpy 1.11 error after the upgrade.

@doutriaux1 doutriaux1 modified the milestone: 3.0 May 5, 2017

@doutriaux1 doutriaux1 assigned dnadeau4 and unassigned dnadeau4 May 5, 2017

@doutriaux1 doutriaux1 modified the milestones: 3.0, 3.1 Mar 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment