Skip to content
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

regrid broken? #237

Closed
doutriaux1 opened this issue Apr 13, 2018 · 1 comment
Closed

regrid broken? #237

doutriaux1 opened this issue Apr 13, 2018 · 1 comment
Assignees
Milestone

Comments

@doutriaux1
Copy link
Contributor

import cdms2
import vcs
f=cdms2.open(vcs.sample_data+"/clt.nc")
s=f("clt")
u=f("u")
s.regrid(u)

gives:

/Users/doutriaux1/anaconda2/envs/cdat8/lib/python2.7/site-packages/cdms2/avariable.py:1146: Warning: 
avariable.regrid: We chose regridTool = esmf for you among the following choices:
   Tools ->    'regrid2' (old behavior)
               'esmf' (conserve, patch, linear) or
               'libcf' (linear)
  warnings.warn(message, Warning)
/Users/doutriaux1/anaconda2/envs/cdat8/lib/python2.7/site-packages/cdms2/avariable.py:1153: Warning: 
avariable.regrid: We chose regridMethod = linear for you among the following choices:
    'conserve' or 'linear' or 'patch'
  warnings.warn(message, Warning)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-5f18d310af48> in <module>()
----> 1 s.regrid(u)

/Users/doutriaux1/anaconda2/envs/cdat8/lib/python2.7/site-packages/cdms2/avariable.pyc in regrid(self, togrid, missing, order, mask, **keywords)
   1179                             dstGridMask=None,
   1180                             dstGridAreas=None,
-> 1181                             **keywords)
   1182             # now interpolate
   1183             return ro(self, **keywords)

/Users/doutriaux1/anaconda2/envs/cdat8/lib/python2.7/site-packages/cdms2/mvCdmsRegrid.pyc in __init__(self, srcGrid, dstGrid, dtype, regridMethod, regridTool, srcGridMask, srcGridAreas, dstGridMask, dstGridAreas, **args)
    353 
    354         srcCoords = _getCoordList(srcGrid)
--> 355         dstCoords = _getCoordList(dstGrid)
    356 
    357         regridTool = str(regridTool)  # force string if unicode or byte

/Users/doutriaux1/anaconda2/envs/cdat8/lib/python2.7/site-packages/cdms2/mvCdmsRegrid.pyc in _getCoordList(grid)
    227 
    228         # have axes, need to convert to curvilinear grid
--> 229         cgrid = grid.toCurveGrid()
    230 
    231         lats = cgrid.getLatitude()

AttributeError: 'TransientVariable' object has no attribute 'toCurveGrid'
@doutriaux1 doutriaux1 added the bug label Apr 13, 2018
@doutriaux1 doutriaux1 added this to the 3.1 milestone Apr 13, 2018
@dnadeau4
Copy link
Contributor

You cannot pass a transient Variable to the regridder but you need to pass a grid as documented
here.

I am still working on publishing the API documentation. You can find the regrid function here

import cdms2
import vcs
f=cdms2.open(vcs.sample_data+"/clt.nc")
s=f("clt")
u=f("u")
s.regrid(u.getGrid())

@doutriaux1 doutriaux1 modified the milestone: 3.1 Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants