-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support printing Datasets on xarray>2024.1.0 (#153)
* fix dtype to work with xarray > 202401 * move print dataset test to new file * fixed test that wasn't working if xarray<2024.2.0 * simplify print test * just need to see of repr(ds1) works, not test the results
- Loading branch information
1 parent
cd3c7f5
commit f499a05
Showing
2 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import xarray as xr | ||
|
||
|
||
def test_da_repr(tmp_path, request): | ||
"""Test writing a single DataArray to a single grib2 message.""" | ||
target_dir = tmp_path / "test_to_grib2" | ||
target_dir.mkdir() | ||
|
||
datadir = request.config.rootdir / "tests" / "data" / "gfs_20221107" | ||
|
||
filters = { | ||
"productDefinitionTemplateNumber": 0, | ||
"typeOfFirstFixedSurface": 1, | ||
"shortName": "TMP", | ||
} | ||
ds1 = xr.open_dataset( | ||
datadir / "gfs.t00z.pgrb2.1p00.f012_subset", | ||
engine="grib2io", | ||
filters=filters, | ||
) | ||
|
||
_ = repr(ds1) |