Skip to content

Commit

Permalink
fixed test netcdf
Browse files Browse the repository at this point in the history
testbmirunnetcdf and testapirun_netcfd did fail (OSError: [Errno -51] NetCDF: Unknown file format: staticoutmaps.nc)
  • Loading branch information
verseve committed Jun 21, 2022
1 parent 0a97d51 commit b5a11f7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions wflow/wf_netcdfio.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ def date_range(start, end, timestepsecs):
self.buffdirty = False

globmetadata.update(metadata)

self.nc_trg = None

prepare_nc(
self.ncfile,
Expand Down Expand Up @@ -479,10 +481,11 @@ def savetimestep(self, timestep, pcrdata, unit="mm", var="P", name="Precipitatio
"""
# Open target netCDF file
var = os.path.basename(var)
self.nc_trg = netCDF4.Dataset(
self.ncfile, "a", format=self.Format, zlib=self.zlib, complevel=9
)
self.nc_trg.set_fill_off()
if not self.nc_trg:
self.nc_trg = netCDF4.Dataset(
self.ncfile, "a", format=self.Format, zlib=self.zlib, complevel=9
)
self.nc_trg.set_fill_off()
# read time axis and convert to time objects
# TODO: use this to append time
# time = self.nc_trg.variables['time']
Expand Down

0 comments on commit b5a11f7

Please sign in to comment.