Open pmav99 opened 4 months ago
Here is the implementation in io_test.py
def write_netcdf(ds, nc_out):
# Remove dict and multi-dimensional arrays not supported in netCDF
del ds.attrs["variables"]
del ds.attrs["ikle2"]
try:
del ds.attrs["ikle3"]
except KeyError:
pass
# Write netCDF file
ds.to_netcdf(nc_out)
both variables
and ikle2
(and ikle3
for 3d outputs) need to be deleted to to write to netcdf.
ikle2
/ikle3
, this should be solvable with #40 variables
, I think it could be wise to adapt UGRID conventions for all variable names. this would make the read/write operations easier: Selafins .slf format <-> xarray UGRID datasets
. To achieve this, we'd need to revisit the current implementation of the variables names.
I am not sure if xarray-selafin, wants to support exporting selafin files as netcdfs, but the way the xarray attributes are currently being utilized is not compatible with netcdf. For example:
results in: