-
Notifications
You must be signed in to change notification settings - Fork 19
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
Weighted-mean by area for 1D land-compressed CF Field #731
Comments
This is the output when I turn debugging on. Any suggestions?
|
With embedded print statements, it seems that the _weights_yyy function is being called for some reason with domain_axis=None and geometry_type=polygon. It looks like the next loop over auxiliary_coordinates_1d.items() is not getting entered into (maybe there are no items?). |
One of the CF-python managers has said: |
It looks like on the JASMIN supercomputer, with the |
I tried your 3.16.1 version, which I believe is almost identical to your not-released-yet 3.17 version, based upon your commits in #721 . And the issue I describe here in #731 still isn't fixed by going from (the default on JASMIN's jaspy) 3.15.3 to 3.16.1. |
I put some print statements in the 3.16.1 code, and in the I commented out the code that halts
|
And I am now wondering why CF is trying to use polygons for this dataset? The dataset has a regular N96 grid. |
Hi Patrick, Thanks for reporting this. There are two things going on here:
You can add bounds and then everything will work (no new version of cf-python necessary, I think): >>> import cf
>>> f = cf.read('converted.nc')[0]
>>> f.dump()
----------------------------------------------------------------------------------------------------
Field: long_name=Concentration of atmospheric CO2, expressed as a mass mixing ratio. (ncvar%co2_mmr)
----------------------------------------------------------------------------------------------------
_FillValue = -1e+20
long_name = 'Concentration of atmospheric CO2, expressed as a mass mixing
ratio.'
missing_value = -1e+20
units = ''
Data(time(1), latitude(112), longitude(192)) = [[[--, ..., --]]]
Cell Method: time
Cell Method: : mean
Domain Axis: latitude(112)
Domain Axis: longitude(192)
Domain Axis: time(1)
Dimension coordinate: time
calendar = '365_day'
standard_name = 'time'
units = 'seconds since 2010-01-01 00:00:00'
Data(time(1)) = [2014-01-01 00:00:00] 365_day
Dimension coordinate: latitude
standard_name = 'latitude'
units = 'degrees_north'
Data(latitude(112)) = [-55.625, ..., 83.125] degrees_north
Dimension coordinate: longitude
standard_name = 'longitude'
units = 'degrees_east'
Data(longitude(192)) = [0.9375, ..., 359.0625] degrees_east
>>> # Add the bounds
>>> x = f.coord('X')
>>> x.set_bounds(x.create_bounds())
>>> y = f.coord('Y')
>>> y.set_bounds(y.create_bounds(max=90, min=-90))
>>> f.dump()
----------------------------------------------------------------------------------------------------
Field: long_name=Concentration of atmospheric CO2, expressed as a mass mixing ratio. (ncvar%co2_mmr)
----------------------------------------------------------------------------------------------------
_FillValue = -1e+20
long_name = 'Concentration of atmospheric CO2, expressed as a mass mixing
ratio.'
missing_value = -1e+20
units = ''
Data(time(1), latitude(112), longitude(192)) = [[[--, ..., --]]]
Cell Method: time
Cell Method: : mean
Domain Axis: latitude(112)
Domain Axis: longitude(192)
Domain Axis: time(1)
Dimension coordinate: time
calendar = '365_day'
standard_name = 'time'
units = 'seconds since 2010-01-01 00:00:00'
Data(time(1)) = [2014-01-01 00:00:00] 365_day
Dimension coordinate: latitude
standard_name = 'latitude'
units = 'degrees_north'
Data(latitude(112)) = [-55.625, ..., 83.125] degrees_north
Bounds:units = 'degrees_north'
Bounds:Data(latitude(112), 2) = [[-90.0, ..., 90.0]] degrees_north
Dimension coordinate: 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
>>> # Collapse the field
>>> a = f.collapse('mean', axes='area', weights='area')
>>> print(a)
Field: long_name=Concentration of atmospheric CO2, expressed as a mass mixing ratio. (ncvar%co2_mmr)
----------------------------------------------------------------------------------------------------
Data : long_name=Concentration of atmospheric CO2, expressed as a mass mixing ratio.(time(1), latitude(1), longitude(1))
Cell methods : time : mean area: mean
Dimension coords: time(1) = [2014-01-01 00:00:00] 365_day
: latitude(1) = [0.0] degrees_north
: longitude(1) = [180.0] degrees_east
>>> print(a.array)
[[[0.0005993416998535397]]] Do let us know if that works for you! |
Hi cf-python'ers
I am trying to do a global land-only area-weighted average with CF Python of a field that is a 1D land-only array (instead of 2D). I'm using a script that someone else made to get these in the right 1D format instead of the 1D format that JULES makes. But I get an error when I try to do this in CF Python. Can you advise me on this? See below.
Patrick
On the CEDA Jasmin supercomputer, I do this:
The text was updated successfully, but these errors were encountered: