Skip to content

genutil.area_weights doesn't work with non-cartesian grids (most CMIP5 ocean grids) #6

@chaosphere2112

Description

@chaosphere2112

This example outlines the issue:

import cdms2 as cdm
import genutil as gutil
infile = '/work/cmip5/historical/ocn/mo/thetao/cmip5.ACCESS1-0.historical.r1i1p1.mo.ocn.Omon.thetao.ver-1.latestX.xml'
f_h = cdm.open(infile)
mask = f_h('thetao',time=slice(0,1),lev=slice(0,1))(squeeze=1)
ocean_area_frac = gutil.area_weights(mask)

>>> ocean_area_frac = gutil.area_weights(mask)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/uvcdat/latest/lib/python2.7/site-packages/genutil/averager.py", line 188, in area_weights
    wt = __myGetAxisWeights(ds, 0, axisoptions)
  File "/usr/local/uvcdat/latest/lib/python2.7/site-packages/genutil/averager.py", line 54, in __myGetAxisWeights
    raise AveragerError, 'Bounds not available to compute weights for dimension: '+ax.id
genutil.averager.AveragerError: ('B', 'o', 'u', 'n', 'd', 's', ' ', 'n', 'o', 't', ' ', 'a', 'v', 'a', 'i', 'l', 'a', 'b', 'l', 'e', ' ', 't', 'o', ' ', 'c', 'o', 'm', 'p', 'u', 't', 'e', ' ', 'w', 'e', 'i', 'g', 'h', 't', 's', ' ', 'f', 'o', 'r', ' ', 'd', 'i', 'm', 'e', 'n', 's', 'i', 'o', 'n', ':', ' ', 'j')

Migrated from: CDAT/cdat#402

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/gridskind/featureCategorizes issue as related to feature request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions