Creating warm start forcing data
We want to add or replace soil data in the forcing data files. We show an example here, where we take the soil data from the output file of a remo run and add this to the forcing file of another run for use as initial lateral boundary conditions.
[15]:
import xarray as xr
import pyremo as pr
afile = xr.open_dataset(
"/work/ch0636/remo/forcing-data/EUR-11/ERA5/vc_27lev/1979/a056530a1979010100.nc"
)
tfile = pr.remo_ds.open_remo_dataset(
"/work/ch0636/remo/forcing-data/era5_warm/a056524a1979010100",
update_meta=True,
parse_time=True,
)
The output dataset (tfile
) contains the spin up soil data. This could also come from another point in time of the same run or another run. The soil is defined by a number of codes or variable names:
[18]:
# soil_codes = [54,55,56,206,207,208,209,232,170,183,84,140,194,141]
warm_codes = [54, 206, 207, 208, 209, 232, 170, 183, 140, 194, 141]
warm_vars = [pr.codes.get_dict(c)["variable"] for c in soil_codes]
warm_vars
[18]:
['TSL', 'TSN', 'TD3', 'TD4', 'TD5', 'GLAC', 'TD', 'TDCL', 'WS', 'WL', 'SN']
Now we copy and replace the data from the output file (tfile
) in the forcing file (afile
).
[19]:
for var in soil_vars:
afile[var] = tfile[var]
We should check the data with a simple plot, we will look at the temperatures here.
[20]:
def get_temps(ds):
temps = ["TSW", "TSI", "TSL", "TSN", "TD3", "TD4", "TD5", "TD", "TDCL"]
dim = xr.DataArray(data=temps, dims="var", name="var")
tda = xr.concat([ds[var] - 273.5 for var in temps], dim=dim)
tda.name = "temperature"
return tda
get_temps(afile).plot(col="var", col_wrap=3)
[20]:
<xarray.plot.facetgrid.FacetGrid at 0x2ba23714bf70>
Adding static fields to the forcing file
The initial forcing file also has to contain static fields (e.g., like the land sea mask or the orography). Remo will read these fields in from the first initial forcing file.
[21]:
from pyremo import data as rd
surflib = rd.surflib("EUR-11", update_meta=True)
surflib
[21]:
<xarray.Dataset> Dimensions: (rlat: 433, rlon: 433) Coordinates: * rlon (rlon) float64 -28.93 -28.82 -28.71 ... 18.38 18.48 18.59 * rlat (rlat) float64 -23.93 -23.82 -23.71 ... 23.38 23.48 23.59 Data variables: (12/14) rotated_pole int32 1 FIB (rlat, rlon) float32 ... BLA (rlat, rlon) float32 ... AZ0 (rlat, rlon) float32 ... ALB (rlat, rlon) float32 ... VGRAT (rlat, rlon) float32 ... ... ... FOREST (rlat, rlon) float32 ... FAO (rlat, rlon) float32 ... WSMX (rlat, rlon) float32 ... BETA (rlat, rlon) float32 ... WMINLOK (rlat, rlon) float32 ... WMAXLOK (rlat, rlon) float32 ... Attributes: CDI: Climate Data Interface version 1.9.8 (https://mpimet.mpg.de... Conventions: CF-1.6 history: Wed Jul 01 12:03:07 2020: cdo -f nc copy lib_EUR-11_frac li... CDO: Climate Data Operators version 1.9.8 (https://mpimet.mpg.de...
- rlat: 433
- rlon: 433
- rlon(rlon)float64-28.93 -28.82 ... 18.48 18.59
- standard_name :
- grid_longitude
- long_name :
- longitude in rotated pole grid
- units :
- degrees
- axis :
- X
array([-28.925, -28.815, -28.705, ..., 18.375, 18.485, 18.595])
- rlat(rlat)float64-23.93 -23.82 ... 23.48 23.59
- standard_name :
- grid_latitude
- long_name :
- latitude in rotated pole grid
- units :
- degrees
- axis :
- Y
array([-23.925, -23.815, -23.705, ..., 23.375, 23.485, 23.595])
- rotated_pole()int32...
- grid_mapping_name :
- rotated_latitude_longitude
- grid_north_pole_longitude :
- -162.0
- grid_north_pole_latitude :
- 39.25
array(1, dtype=int32)
- FIB(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- FIB
- description :
- surface geopotential (orography)
- units :
- m
- layer :
- 1.0
- cf_name :
- orog
- code :
- 129
[187489 values with dtype=float32]
- BLA(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- BLA
- description :
- land sea mask
- units :
- fract.
- layer :
- 1.0
- cf_name :
- sftlf
- code :
- 172
[187489 values with dtype=float32]
- AZ0(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- AZ0
- description :
- surface roughness length
- units :
- m
- layer :
- 1.0
- code :
- 173
[187489 values with dtype=float32]
- ALB(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- ALB
- description :
- surface background albedo
- units :
- fract.
- layer :
- 1.0
- code :
- 174
[187489 values with dtype=float32]
- VGRAT(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- VGRAT
- description :
- vegetation ratio
- layer :
- 1.0
- code :
- 198
[187489 values with dtype=float32]
- VAROR(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- VAROR
- description :
- orographic variance (for surface runoff)
- layer :
- 1.0
- code :
- 199
[187489 values with dtype=float32]
- VLT(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- VLT
- description :
- leaf area index
- units :
- m²/m²
- layer :
- 1.0
- code :
- 200
[187489 values with dtype=float32]
- FOREST(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- FOREST
- description :
- vegetation type
- layer :
- 1.0
- code :
- 212
[187489 values with dtype=float32]
- FAO(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- FAO
- description :
- FAO data set (soil data flags)
- units :
- 0...6.
- layer :
- 1.0
- code :
- 226
[187489 values with dtype=float32]
- WSMX(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- WSMX
- description :
- field capacity of soil
- units :
- m³/m³
- layer :
- 1.0
- code :
- 229
[187489 values with dtype=float32]
- BETA(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- BETA
- layer :
- 1.0
- code :
- 272
[187489 values with dtype=float32]
- WMINLOK(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- WMINLOK
- layer :
- 1.0
- code :
- 273
[187489 values with dtype=float32]
- WMAXLOK(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- WMAXLOK
- layer :
- 1.0
- code :
- 274
[187489 values with dtype=float32]
- CDI :
- Climate Data Interface version 1.9.8 (https://mpimet.mpg.de/cdi)
- Conventions :
- CF-1.6
- history :
- Wed Jul 01 12:03:07 2020: cdo -f nc copy lib_EUR-11_frac lib_EUR-11_frac.nc
- CDO :
- Climate Data Operators version 1.9.8 (https://mpimet.mpg.de/cdo)
We have to take care if the coordinate values in the afile and surface library are not exactly the same. To make sure, we set join="override"
to simply use the coordinate values from the afile.
[22]:
afile = xr.merge([afile, surflib], join="override")
afile
[22]:
<xarray.Dataset> Dimensions: (lev: 27, lev_i: 28, rlat: 433, rlon: 433, time: 1) Coordinates: * rlat (rlat) float64 -23.93 -23.82 ... 23.49 23.6 * rlon (rlon) float64 -28.93 -28.82 ... 18.49 18.6 * time (time) datetime64[ns] 1979-01-01 * lev (lev) int64 1 2 3 4 5 6 7 ... 22 23 24 25 26 27 * lev_i (lev_i) int64 1 2 3 4 5 6 ... 23 24 25 26 27 28 lon (rlat, rlon) float64 ... lat (rlat, rlon) float64 ... Data variables: (12/41) T (time, lev, rlat, rlon) float32 ... U (time, lev, rlat, rlon) float32 ... V (time, lev, rlat, rlon) float32 ... PS (time, rlat, rlon) float32 ... RF (time, lev, rlat, rlon) float32 ... TSW (time, rlat, rlon) float32 nan nan ... nan 271.5 ... ... FOREST (rlat, rlon) float32 ... FAO (rlat, rlon) float32 ... WSMX (rlat, rlon) float32 ... BETA (rlat, rlon) float32 ... WMINLOK (rlat, rlon) float32 ... WMAXLOK (rlat, rlon) float32 ... Attributes: CDI: Climate Data Interface version 1.9.6 (http://mpimet.mpg.de/... Conventions: CF-1.6 history: preprocessing with pyremo = 0.1.0 institution: European Centre for Medium-Range Weather Forecasts CDO: Climate Data Operators version 1.9.6 (http://mpimet.mpg.de/...
- lev: 27
- lev_i: 28
- rlat: 433
- rlon: 433
- time: 1
- rlat(rlat)float64-23.93 -23.82 -23.71 ... 23.49 23.6
- standard_name :
- grid_latitude
- long_name :
- latitude in rotated pole grid
- units :
- degrees
- axis :
- Y
array([-23.925, -23.815, -23.705, ..., 23.375, 23.485, 23.595])
- rlon(rlon)float64-28.93 -28.82 -28.71 ... 18.49 18.6
- standard_name :
- grid_longitude
- long_name :
- longitude in rotated pole grid
- units :
- degrees
- axis :
- X
array([-28.925, -28.815, -28.705, ..., 18.375, 18.485, 18.595])
- time(time)datetime64[ns]1979-01-01
array(['1979-01-01T00:00:00.000000000'], dtype='datetime64[ns]')
- lev(lev)int641 2 3 4 5 6 7 ... 22 23 24 25 26 27
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27])
- lev_i(lev_i)int641 2 3 4 5 6 7 ... 23 24 25 26 27 28
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28])
- lon(rlat, rlon)float64...
- standard_name :
- longitude
- long_name :
- longitude
- units :
- degrees_east
[187489 values with dtype=float64]
- lat(rlat, rlon)float64...
- standard_name :
- latitude
- long_name :
- latitude
- units :
- degrees_north
[187489 values with dtype=float64]
- T(time, lev, rlat, rlon)float32...
- name :
- T
- code :
- 130
- description :
- temperature
- units :
- K
- grid_mapping :
- rotated_latitude_longitude
[5062203 values with dtype=float32]
- U(time, lev, rlat, rlon)float32...
- name :
- U
- code :
- 131
- description :
- u-velocity
- units :
- m/s
- grid_mapping :
- rotated_latitude_longitude
[5062203 values with dtype=float32]
- V(time, lev, rlat, rlon)float32...
- name :
- V
- code :
- 132
- description :
- v-velocity
- units :
- m/s
- grid_mapping :
- rotated_latitude_longitude
[5062203 values with dtype=float32]
- PS(time, rlat, rlon)float32...
- name :
- PS
- code :
- 134
- description :
- Surface pressure
- units :
- Pa
- grid_mapping :
- rotated_latitude_longitude
[187489 values with dtype=float32]
- RF(time, lev, rlat, rlon)float32...
- name :
- Specific humidity
- short_name :
- q
- units :
- kg kg-1
- code :
- 133
[5062203 values with dtype=float32]
- TSW(time, rlat, rlon)float32nan nan nan nan ... 271.5 nan 271.5
- name :
- TSW
- code :
- 55
- description :
- surface temperature (water)
- units :
- K
- grid_mapping :
- rotated_latitude_longitude
array([[[ nan, nan, ..., 297.6727 , 297.78195], [ nan, nan, ..., 297.73825, 297.84213], ..., [274.5075 , 274.56622, ..., nan, 271.46045], [274.08154, 274.08154, ..., nan, 271.46045]]], dtype=float32)
- SEAICE(time, rlat, rlon)float32...
- name :
- SEAICE
- code :
- 210
- description :
- sea ice cover
- units :
- fract.
- grid_mapping :
- rotated_latitude_longitude
[187489 values with dtype=float32]
- QW(time, lev, rlat, rlon)float32...
- name :
- QW
- code :
- 153
- description :
- liquid water content
- units :
- kg/kg
- grid_mapping :
- rotated_latitude_longitude
[5062203 values with dtype=float32]
- QD(time, lev, rlat, rlon)float32...
- name :
- QD
- code :
- 133
- description :
- specific humidity
- units :
- kg/kg
- grid_mapping :
- rotated_latitude_longitude
[5062203 values with dtype=float32]
- QDBL(time, rlat, rlon)float32...
- name :
- QDBL
- code :
- 84
- description :
- specific humidity surface (land)
- units :
- kg/kg
- grid_mapping :
- rotated_latitude_longitude
[187489 values with dtype=float32]
- TSI(time, rlat, rlon)float32nan nan nan nan ... 271.4 nan 271.4
- name :
- TSI
- code :
- 56
- description :
- surface temperature (ice)
- units :
- K
- grid_mapping :
- rotated_latitude_longitude
array([[[ nan, nan, ..., 271.37, 271.37], [ nan, nan, ..., 271.37, 271.37], ..., [271.37, 271.37, ..., nan, 271.37], [271.37, 271.37, ..., nan, 271.37]]], dtype=float32)
- hyai(lev_i)float64...
array([ 0. , 5000. , 10000. , 13600. , 14736.355469, 15689.207031, 16266.609375, 16465.003906, 16297.621094, 15791.597656, 14985.269531, 13925.519531, 12665.292969, 11261.230469, 9771.40625 , 8253.210938, 6761.339844, 5345.914062, 4050.717773, 2911.569336, 1954.805176, 1195.889893, 638.148926, 271.626465, 72.063583, 0. , 0. , 0. ])
- hybi(lev_i)float64...
array([0. , 0. , 0. , 0. , 0.020319, 0.036975, 0.059488, 0.087895, 0.122004, 0.161441, 0.205703, 0.254189, 0.306235, 0.361145, 0.418202, 0.476688, 0.535887, 0.595084, 0.653565, 0.710594, 0.765405, 0.817167, 0.864956, 0.907716, 0.944213, 0.972985, 0.992282, 1. ])
- hyam(lev)float64...
array([ 2500. , 7500. , 11800. , 14168.177734, 15212.78125 , 15977.908203, 16365.806641, 16381.3125 , 16044.609375, 15388.433594, 14455.394531, 13295.40625 , 11963.261719, 10516.318359, 9012.308594, 7507.275391, 6053.626953, 4698.315918, 3481.143555, 2433.187256, 1575.347534, 917.019409, 454.887695, 171.845024, 36.031792, 0. , 0. ])
- hybm(lev)float64...
array([0. , 0. , 0. , 0.01016 , 0.028647, 0.048231, 0.073691, 0.104949, 0.141723, 0.183572, 0.229946, 0.280212, 0.33369 , 0.389674, 0.447445, 0.506287, 0.565485, 0.624324, 0.682079, 0.738 , 0.791286, 0.841061, 0.886336, 0.925965, 0.958599, 0.982633, 0.996141])
- rotated_latitude_longitude()int32...
- grid_mapping_name :
- rotated_latitude_longitude
- grid_north_pole_latitude :
- 39.25
- grid_north_pole_longitude :
- -162.0
- north_pole_grid_longitude :
- 0.0
array(0, dtype=int32)
- TSL(time, rlat, rlon)float32284.9 285.0 285.2 ... 239.6 243.9
- grid_mapping :
- rotated_pole
- variable :
- TSL
- description :
- surface temperature (land)
- units :
- K
- layer :
- 1.0
- code :
- 54
array([[[284.88602, 285.04398, ..., 296.86893, 296.83868], [284.84366, 284.90106, ..., 296.75827, 296.72217], ..., [266.04196, 266.68546, ..., 243.06488, 241.38116], [266.87408, 266.8496 , ..., 239.62808, 243.91678]]], dtype=float32)
- TSN(time, rlat, rlon)float32284.9 285.0 285.2 ... 253.2 255.6
- grid_mapping :
- rotated_pole
- variable :
- TSN
- description :
- snow temperature (see description below)
- units :
- K
- layer :
- 1.0
- code :
- 206
array([[[284.88602, 285.04398, ..., 296.86893, 296.83868], [284.84366, 284.90106, ..., 296.75827, 296.72217], ..., [266.04196, 266.68546, ..., 254.49155, 253.66458], [268.63736, 266.8496 , ..., 253.24747, 255.6335 ]]], dtype=float32)
- TD3(time, rlat, rlon)float32284.9 285.0 285.2 ... 268.6 268.8
- grid_mapping :
- rotated_pole
- variable :
- TD3
- description :
- soil temperature 0.065m thickness
- units :
- K
- layer :
- 1.0
- code :
- 207
array([[[284.88602, 285.04398, ..., 296.86893, 296.83868], [284.84366, 284.90106, ..., 296.75827, 296.72217], ..., [266.04196, 266.68546, ..., 267.6753 , 267.765 ], [270.93237, 266.8496 , ..., 268.587 , 268.7666 ]]], dtype=float32)
- TD4(time, rlat, rlon)float32288.2 288.1 288.3 ... 269.2 269.4
- grid_mapping :
- rotated_pole
- variable :
- TD4
- description :
- soil temperature 0.254m thickness
- units :
- K
- layer :
- 1.0
- code :
- 208
array([[[288.17474, 288.13864, ..., 296.86893, 296.83868], [288.19537, 288.17322, ..., 296.75827, 296.72217], ..., [264.18777, 264.9309 , ..., 268.35538, 268.44003], [271.3742 , 265.00278, ..., 269.2255 , 269.38177]]], dtype=float32)
- TD5(time, rlat, rlon)float32291.1 291.0 290.9 ... 271.3 271.4
- grid_mapping :
- rotated_pole
- variable :
- TD5
- description :
- soil temperature 0.913m thickness
- units :
- K
- layer :
- 1.0
- code :
- 209
array([[[291.0765 , 290.955 , ..., 296.86893, 296.83868], [291.08212, 291.05655, ..., 296.75827, 296.72217], ..., [270.02158, 270.04324, ..., 270.6096 , 270.6905 ], [272.46466, 270.91864, ..., 271.29053, 271.40295]]], dtype=float32)
- GLAC(time, rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- GLAC
- description :
- glacier mask (0.: no
- units :
- 1.: yes)
- layer :
- 1.0
- code :
- 232
[187489 values with dtype=float32]
- TD(time, rlat, rlon)float32300.3 300.2 300.1 ... 273.1 273.2
- grid_mapping :
- rotated_pole
- variable :
- TD
- description :
- deep soil temperature
- units :
- K
- layer :
- 1.0
- code :
- 170
array([[[300.33023, 300.19986, ..., 296.86893, 296.83868], [300.35754, 300.33487, ..., 296.75827, 296.72217], ..., [272.16855, 272.14807, ..., 273.04382, 273.085 ], [273.8371 , 273.2909 , ..., 273.1437 , 273.24658]]], dtype=float32)
- TDCL(time, rlat, rlon)float32299.8 299.7 299.6 ... 272.1 272.2
- grid_mapping :
- rotated_pole
- variable :
- TDCL
- description :
- soil temperature 5.700m thickness
- units :
- K
- layer :
- 1.0
- code :
- 183
array([[[299.80676, 299.7127 , ..., 296.86893, 296.83868], [299.84647, 299.8254 , ..., 296.75827, 296.72217], ..., [272.02554, 272.0241 , ..., 271.94812, 272.03336], [274.25668, 273.6145 , ..., 272.0887 , 272.1748 ]]], dtype=float32)
- WS(time, rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- WS
- description :
- soil wetness
- units :
- m
- layer :
- 1.0
- cf_name :
- mrso
- code :
- 140
[187489 values with dtype=float32]
- WL(time, rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- WL
- description :
- skin reservoir content
- units :
- m
- layer :
- 1.0
- code :
- 194
[187489 values with dtype=float32]
- SN(time, rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- SN
- description :
- snow depth
- units :
- m
- layer :
- 1.0
- cf_name :
- snw
- code :
- 141
[187489 values with dtype=float32]
- rotated_pole()int321
- grid_mapping_name :
- rotated_latitude_longitude
- grid_north_pole_longitude :
- -162.0
- grid_north_pole_latitude :
- 39.25
array(1, dtype=int32)
- FIB(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- FIB
- description :
- surface geopotential (orography)
- units :
- m
- layer :
- 1.0
- cf_name :
- orog
- code :
- 129
[187489 values with dtype=float32]
- BLA(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- BLA
- description :
- land sea mask
- units :
- fract.
- layer :
- 1.0
- cf_name :
- sftlf
- code :
- 172
[187489 values with dtype=float32]
- AZ0(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- AZ0
- description :
- surface roughness length
- units :
- m
- layer :
- 1.0
- code :
- 173
[187489 values with dtype=float32]
- ALB(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- ALB
- description :
- surface background albedo
- units :
- fract.
- layer :
- 1.0
- code :
- 174
[187489 values with dtype=float32]
- VGRAT(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- VGRAT
- description :
- vegetation ratio
- layer :
- 1.0
- code :
- 198
[187489 values with dtype=float32]
- VAROR(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- VAROR
- description :
- orographic variance (for surface runoff)
- layer :
- 1.0
- code :
- 199
[187489 values with dtype=float32]
- VLT(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- VLT
- description :
- leaf area index
- units :
- m²/m²
- layer :
- 1.0
- code :
- 200
[187489 values with dtype=float32]
- FOREST(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- FOREST
- description :
- vegetation type
- layer :
- 1.0
- code :
- 212
[187489 values with dtype=float32]
- FAO(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- FAO
- description :
- FAO data set (soil data flags)
- units :
- 0...6.
- layer :
- 1.0
- code :
- 226
[187489 values with dtype=float32]
- WSMX(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- WSMX
- description :
- field capacity of soil
- units :
- m³/m³
- layer :
- 1.0
- code :
- 229
[187489 values with dtype=float32]
- BETA(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- BETA
- layer :
- 1.0
- code :
- 272
[187489 values with dtype=float32]
- WMINLOK(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- WMINLOK
- layer :
- 1.0
- code :
- 273
[187489 values with dtype=float32]
- WMAXLOK(rlat, rlon)float32...
- grid_mapping :
- rotated_pole
- variable :
- WMAXLOK
- layer :
- 1.0
- code :
- 274
[187489 values with dtype=float32]
- CDI :
- Climate Data Interface version 1.9.6 (http://mpimet.mpg.de/cdi)
- Conventions :
- CF-1.6
- history :
- preprocessing with pyremo = 0.1.0
- institution :
- European Centre for Medium-Range Weather Forecasts
- CDO :
- Climate Data Operators version 1.9.6 (http://mpimet.mpg.de/cdo)
Now, we can write back the afile to Netcdf. We have to take care of correct encoding of missing values here.
[24]:
fillvars = ["TSW", "SEAICE", "TSI"]
for var in afile:
# we have to set the encoding here explicitly, otherwise xarray.to_netcdf will
# encode missing values by NaN, which will crash REMO...
if var in fillvars:
afile[var].encoding["_FillValue"] = 1.0e20
else:
afile[var].encoding["_FillValue"] = None
afile.to_netcdf(
"/work/ch0636/remo/forcing-data/EUR-11/ERA5/vc_27lev/1979/a056530a1979010100_warm_soil.nc"
)