Skip to content

Commit

Permalink
remove h5netcdf dependency; fixes #48
Browse files Browse the repository at this point in the history
  • Loading branch information
thurber committed Jun 4, 2021
1 parent 2f70751 commit bacde88
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
8 changes: 4 additions & 4 deletions mosartwmpy/grid/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,11 @@ def to_files(self, path: str) -> None:
for df in dfs:
names.append(f'{df["key"]}.df.nc')
paths.append(f'{tmpdir}/{names[-1]}')
df['frame'].to_xarray().to_netcdf(paths[-1], engine='h5netcdf')
df['frame'].to_xarray().to_netcdf(paths[-1], engine='scipy')
for ds in xrs:
names.append(f'{ds["key"]}.xr.nc')
paths.append(f'{tmpdir}/{names[-1]}')
ds['data_array'].to_netcdf(paths[-1], engine='h5netcdf')
ds['data_array'].to_netcdf(paths[-1], engine='scipy')
with ZipFile(path, 'w', compression=ZIP_DEFLATED, compresslevel=9) as zip:
for i, filename in enumerate(paths):
zip.write(filename, names[i])
Expand Down Expand Up @@ -441,13 +441,13 @@ def from_files(path: Path) -> 'Grid':
setattr(grid, key, npdf[key].values)
if filename.endswith('df.nc'):
key = filename.split('.')[0]
ds = xr.open_dataset(file, engine='h5netcdf')
ds = xr.open_dataset(file, engine='scipy')
df = ds.to_dataframe()
setattr(grid, key, df)
ds.close()
if filename.endswith('xr.nc'):
key = filename.split('.')[0]
ds = xr.open_dataarray(file, engine='h5netcdf').load()
ds = xr.open_dataarray(file, engine='scipy').load()
setattr(grid, key, ds)
ds.close()

Expand Down
Binary file modified mosartwmpy/tests/grid.zip
Binary file not shown.
23 changes: 11 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
bmipy==2.0
dask[complete]==2021.01.1
dask[complete]==2021.5.1
epiweeks==2.1.2
h5netcdf==0.10.0
matplotlib==3.3.3
matplotlib==3.4.2
nc-time-axis==1.2.0
netCDF4==1.5.4
numexpr==2.7.2
numpy==1.19.4
pandas==1.1.4
netCDF4==1.5.6
numexpr==2.7.3
numpy==1.20.3
pandas==1.2.4
pathvalidate==2.3.0
psutil==5.7.3
pyarrow==3.0.0
psutil==5.8.0
pyarrow==4.0.1
python-benedict==0.24.0
regex==2020.11.13
regex==2021.4.4
requests==2.25.1
rioxarray==0.3.1
rioxarray==0.4.2
tqdm==4.60.0
xarray==0.16.1
xarray==0.18.2

0 comments on commit bacde88

Please sign in to comment.