From f2d763784a16d3c7b0a7e32eca0de0a26af543ed Mon Sep 17 00:00:00 2001 From: Carlos Rueda Date: Mon, 19 Aug 2024 11:50:21 -0700 Subject: [PATCH] pbp-plot now explicitly uses h5netcdf as engine And new option `--engine name` allows to specify the engine to use --- CHANGELOG.md | 3 +++ pbp/plot.py | 10 +++++++++- pyproject.toml | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1183c7b..ac150f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ 2024-08 +- 1.2.5 `pbp-plot` now explicitly uses `h5netcdf` when calling `xarray.open_dataset`. + But a new option `--engine name` allows to specify the engine to use. + - 1.2.3 `HmbGen` adjustments: - `check_parameters` now returns `str | None`, with string indicating any errors. - `process_date` now returns `ProcessDayResult | str`, with string indicating any errors. diff --git a/pbp/plot.py b/pbp/plot.py index aae1313..6aabf2e 100644 --- a/pbp/plot.py +++ b/pbp/plot.py @@ -78,6 +78,14 @@ def parse_arguments(): help="Only show the plot (do not generate .jpg files)", ) + parser.add_argument( + "--engine", + type=str, + metavar="name", + default="h5netcdf", + help="Engine given to xarray.open_dataset. Default: %(default)s", + ) + parser.add_argument("netcdf", nargs="+", help="netcdf file(s) to plot") return parser.parse_args() @@ -93,7 +101,7 @@ def main(): show = opts.show or opts.only_show for nc_filename in opts.netcdf: print(f"plotting {nc_filename} at {opts.dpi} dpi") - ds = xr.open_dataset(nc_filename) + ds = xr.open_dataset(nc_filename, engine=opts.engine) jpeg_filename = None if opts.only_show else nc_filename.replace(".nc", ".jpg") plot_dataset_summary( ds, diff --git a/pyproject.toml b/pyproject.toml index e930242..1837765 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "mbari-pbp" -version = "1.2.4" +version = "1.2.5" description = "PyPAM based Processing" authors = [ "Carlos Rueda ",