pycif.plugins.datastreams.fluxes.lmdz_bin — API reference#
Configuration reference: lmdz_bin plugin
- pycif.plugins.datastreams.fluxes.lmdz_bin.read.read(self, name, tracdir, tracfile, varnames, dates, interpol_flx=False, **kwargs)[source]#
Read LMDZ-DISPERSION fluxes from Fortran unformatted binary files.
For each requested date, opens the corresponding binary file and reads it record by record until exhaustion; each record holds a pair of forward and tangent-linear real values per grid cell, reshaped to
(ndays_in_file, nlat, nlon)using the domain’s horizontal size. Timestamps are attributed to each daily record starting at dd.- Parameters:
self – the model Plugin, providing
domain(fornlon/nlat).name – the name of the component
tracdir – flux directory and file format (a
strftimepattern applied to each date in dates)tracfile – flux directory and file format (a
strftimepattern applied to each date in dates)varnames – Unused, kept for interface consistency with other flux plugins.
dates – list of dates to extract
interpol_flx (bool) – if True, interpolates fluxes at time t from
files (values of surrounding available)
- Returns:
the forward-flux data (from the first requested file), with dimensions
(time, lat, lon), indexed by the daily timestamps derived from dates.- Return type:
xr.DataArray
- pycif.plugins.datastreams.fluxes.lmdz_bin.write.write(self, name, flx_file, flx, mode='a', **kwargs)[source]#
Write flux to an LMDZ-DISPERSION compatible Fortran binary file.
Extracts the
"fwd"and"tl"(tangent-linear) fields from flx, transposes them to the LMDZ physical vectorial grid layout, and dumps the interleaved forward/tangent-linear values as raw binary to flx_file.- Parameters:
self (Fluxes) – the Fluxes plugin
name – Unused, kept for interface consistency with other flux plugins.
flx_file (str) – the file where to write fluxes
flx (xarray.Dataset) – fluxes data to write, with
"fwd"and"tl"data variablesmode (str) – Unused, kept for interface consistency; the file is always (over)written.