I'm trying to use xarray to append and write a netCDF file. Some info on the original file is below.
Dimensions: (Time: 744, south_north: 289, west_east: 339)
Coordinates:
XLAT (Time, south_north, west_east) float32 ...
XLONG (Time, south_north, west_east) float32 ...
Dimensions without coordinates: Time, south_north, west_east
Data variables:
Times (Time) |S19 ...
RAINNC (Time, south_north, west_east) float32 ...
I_RAINNC (Time, south_north, west_east) int32 ...
SNOWNC (Time, south_north, west_east) float32 ...
GRAUPELNC (Time, south_north, west_east) float32 ...
HAILNC (Time, south_north, west_east) float32 ...
Here's some information on the appended file (two variables added).
Dimensions: (Time: 744, south_north: 289, west_east: 339)
Coordinates:
XLAT (Time, south_north, west_east) float32 ...
XLONG (Time, south_north, west_east) float32 ...
Dimensions without coordinates: Time, south_north, west_east
Data variables:
Times (Time) |S19 ...
RAINNC (Time, south_north, west_east) float32 0.0 0.0 0.0 0.0 0.0
I_RAINNC (Time, south_north, west_east) int32 0 0 0 0 0 0 0 0 0 0 0 0
SNOWNC (Time, south_north, west_east) float32 ...
GRAUPELNC (Time, south_north, west_east) float32 ...
HAILNC (Time, south_north, west_east) float32 ...
PRCP (Time, south_north, west_east) float32 0.0 0.0 0.0 0.0 0.0
CUMPRCP (Time, south_north, west_east) float32 0.0 0.0 0.0 0.0 0.0
I'm attempting to write a new file with xarray.to_netcdf(), but am receiving this error:
ValueError: cannot serialize coordinates because variable RAINNC
already has an attribute 'coordinates'
Any ideas on how to resolve this error?
EDIT:
Data was generated through Weather and Research Forecasting Model (WRF). Data loaded via open_dataset() with decode_cf at default. Attributes for RAINNC are the same for both files and listed below.
OrderedDict([('FieldType', 104),
('MemoryOrder', 'XY '),
('description', 'ACCUMULATED TOTAL GRID SCALE PRECIPITATION'),
('units', 'mm'),
('stagger', ''),
('coordinates', 'XLONG XLAT XTIME')])