Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhassell committed Sep 27, 2023
1 parent 5b8185d commit a7ce7b3
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions cf/test/test_weights.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import cf

f = cf.example_field(6)
f.del_construct('auxiliarycoordinate3')
f.del_construct('grid_mapping_name:latitude_longitude')
g = f.copy()
g.dump()


lon = cf.AuxiliaryCoordinate()
lon.standard_name = 'longitude'
bounds = cf.Data([
[315, 45, 45, 315, 999,999,999,999],
[90 , 0, 0, 45, 75, 135, 90, 0]

], 'degrees_east', masked_values=999).reshape(2, 1, 8)
lon.set_bounds(cf.Bounds(data=bounds))
lon.set_geometry('polygon')

lat = cf.AuxiliaryCoordinate()
lat.standard_name = 'latitude'
bounds = cf.Data([
[0, 0, 90, 0,999,999,999,999],
[0 , 90, 0, 0, -90, 0, 0, 90]

], 'degrees_north', masked_values=999).reshape(2, 1, 8)
lat.set_bounds(cf.Bounds(data=bounds))
lat.set_geometry('polygon')
lon.dump()
f.del_construct('longitude')
f.del_construct('latitude')

#f.dump()
f.set_construct(lon, axes='domainaxis0')
f.set_construct(lat, axes='domainaxis0')
print (f.constructs)

f.dump()


f.collapse('X: mean', verbose=-1, weights=True, great_circle=True)

0 comments on commit a7ce7b3

Please sign in to comment.