-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
In cf
v3.18.0 we get, for a Field with external Cell Measures data:
>>> import cf
>>> f = cf.read('tas_Amon_UKESM1-2-LL_esm-hist_r1i1p1f1_gn_185001-194912.nc')[0]
>>> f.dump()
----------------------------------
Field: air_temperature (ncvar%tas)
----------------------------------
Conventions = 'CF-1.7 CMIP-6.2'
standard_name = 'air_temperature'
units = 'K'
Data(time(1200), latitude(144), longitude(192)) = [[[249.07666015625, ..., 242.0361328125]]] K
Cell Method: area: time(1200): mean
Domain Axis: height(1)
Domain Axis: latitude(144)
Domain Axis: longitude(192)
Domain Axis: time(1200)
Dimension coordinate: time
axis = 'T'
calendar = '360_day'
long_name = 'time'
standard_name = 'time'
units = 'days since 1850-01-01'
Data(time(1200)) = [1850-01-16 00:00:00, ..., 1949-12-16 00:00:00] 360_day
Bounds:calendar = '360_day'
Bounds:units = 'days since 1850-01-01'
Bounds:Data(time(1200), 2) = [[1850-01-01 00:00:00, ..., 1950-01-01 00:00:00]] 360_day
Dimension coordinate: latitude
axis = 'Y'
long_name = 'Latitude'
standard_name = 'latitude'
units = 'degrees_north'
Data(latitude(144)) = [-89.375, ..., 89.375] degrees_north
Bounds:units = 'degrees_north'
Bounds:Data(latitude(144), 2) = [[-90.0, ..., 90.0]] degrees_north
Dimension coordinate: longitude
axis = 'X'
long_name = 'Longitude'
standard_name = 'longitude'
units = 'degrees_east'
Data(longitude(192)) = [0.9375, ..., 359.0625] degrees_east
Bounds:units = 'degrees_east'
Bounds:Data(longitude(192), 2) = [[0.0, ..., 360.0]] degrees_east
Dimension coordinate: height
axis = 'Z'
long_name = 'height'
positive = 'up'
standard_name = 'height'
units = 'm'
Data(height(1)) = [1.5] m
Cell measure: measure:area (external variable: ncvar%areacella)
>>> g = f.collapse('area: mean', weights=True)
ValueError: Can't find weights: Cell measure {} has no data, possibly because it is external. Consider setting cell_measures=False
This error, which ultimately comes from cf.Field.weights
, should not be raised from collapse
, because collapse
manages it's own calls to cf.Field.weights
, and decides which weights
errors to report - and this is not one of them! PR to follow.
Thanks to @CheeseFace for pointing this out.
sadielbartholomew
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working