@@ -41,13 +41,14 @@ def test_grid_topology_location_parse():
41
41
@pytest .mark .online
42
42
def test_polygon_subset ():
43
43
'''
44
- This is a basic integration test for the subsetting of a ROMS sgrid dataset using a polygon.
44
+ This is a basic integration test for the subsetting of a ROMS sgrid dataset using
45
+ a polygon.
45
46
'''
46
47
if fsspec is None :
47
48
raise ImportError ("Must have fsspec installed to run --online tests" )
48
49
fs = fsspec .filesystem (
49
50
"reference" ,
50
- fo = "s3://nextgen-dmac-cloud-ingest /nos/wcofs/nos. wcofs.2ds .best.nc.zarr" ,
51
+ fo = "s3://noaa-nodd-kerchunk-pds /nos/wcofs/wcofs.fields .best.nc.zarr" ,
51
52
remote_protocol = "s3" ,
52
53
remote_options = {"anon" : True },
53
54
target_protocol = "s3" ,
@@ -71,25 +72,25 @@ def test_polygon_subset():
71
72
[- 122.38488806417945 , 34.98888604471138 ],
72
73
]
73
74
)
74
- ds_temp = ds .xsg .subset_vars (['temp_sur ' ])
75
+ ds_temp = ds .xsg .subset_vars (['temp' , 'u' , 'v ' ])
75
76
ds_subset = ds_temp .xsg .subset_polygon (polygon )
76
77
77
- #Check that the subset dataset has the correct dimensions given the original padding
78
+ # Check that the subset dataset has the correct dimensions given the original padding
78
79
assert ds_subset .sizes ['eta_rho' ] == ds_subset .sizes ['eta_psi' ] + 1
79
80
assert ds_subset .sizes ['eta_u' ] == ds_subset .sizes ['eta_psi' ] + 1
80
81
assert ds_subset .sizes ['eta_v' ] == ds_subset .sizes ['eta_psi' ]
81
82
assert ds_subset .sizes ['xi_rho' ] == ds_subset .sizes ['xi_psi' ] + 1
82
83
assert ds_subset .sizes ['xi_u' ] == ds_subset .sizes ['xi_psi' ]
83
84
assert ds_subset .sizes ['xi_v' ] == ds_subset .sizes ['xi_psi' ] + 1
84
85
85
- #Check that the subset rho/psi/u/v positional relationsip makes sense aka psi point is
86
- #'between' it's neighbor rho points
87
- #Note that this needs to be better generalized; it's not trivial to write a test that
88
- #works in all potential cases.
86
+ # Check that the subset rho/psi/u/v positional relationship makes sense aka psi point is
87
+ # 'between' it's neighbor rho points
88
+ # Note that this needs to be better generalized; it's not trivial to write a test that
89
+ # works in all potential cases.
89
90
assert (ds_subset ['lon_rho' ][0 ,0 ] < ds_subset ['lon_psi' ][0 ,0 ]
90
91
and ds_subset ['lon_rho' ][0 ,1 ] > ds_subset ['lon_psi' ][0 ,0 ])
91
92
92
- #ds_subset.temp_sur.isel(ocean_time=0).plot(x="lon_rho", y="lat_rho")
93
+ # ds_subset.temp_sur.isel(ocean_time=0).plot(x="lon_rho", y="lat_rho")
93
94
94
95
def test_polygon_subset_2 ():
95
96
ds = xr .open_dataset (sample_sgrid_file , decode_times = False )
0 commit comments