standardize_fr.sim2#

standardize_fr.sim2(data, *, var_list=None, to_file=False, merge_csv=True)[source]#

Standardizes MeteoFrance “SIM2” datasets downloaded as .csv files from data.gouv website (https://www.data.gouv.fr/datasets/donnees-changement-climatique-sim-quotidienne) into standard netCDF files by:

  • merge all available .csv files

  • add a total_precipitation variable

  • convert .csv files into xarray.Datasets variables, which can then be exported to netCDF files

  • standardize the x and y values

  • embedd the CRS (epsg:27572)

  • standardize netCDF names and attributes (coordinates, grid_mapping)

  • standardize units

Parameters#

data(list of) str or pathlib.Path, or variable (pandas.Dataframe)

data is usually the folder containing all the raw SIM2 tiles downloaded from the data.gouv website [https://www.data.gouv.fr/datasets/donnees-changement-climatique-sim-quotidienne]. It can also be a list of filepaths or pandas variables. It can also be a single filepath or pandas variable.

var_listiterable, optional

List of variable names that will be standardized. Works with SIM2 variable names: ‘DRAINC_Q’ | ‘RUNC_Q’ | ‘EVAP_Q’ | ‘PRETOT_Q’ | ‘T_Q’ … The ‘_Q’ is optional (‘DRAINC’, ‘RUNC’… also work).

If None, all available variables will be standardized.

to_filebool or path (str or pathlib.Path), default False

If True and if data is a path (str or pathlib.Path), the resulting dataset will be exported to the same location as data, with the name ‘SIM2_stz.tif’. If to_file is a path, the resulting dataset will be exported to this specified filepath.

merge_csvbool, default True

Deactivate this ooption (with merge_csv = False) to avoid memory issues (processing will be much slower).

Returns#

data_dsxarray.Dataset

Standardized meteorological data.

If to_file argument is used, the standardized DEM is exported to a file. If to_file = True, the standardized DEM is exported to the GeoTIFF file ‘SIM2_stz.tif’.

Examples#

>>> stzfr.sim2(
    r"E:\Inputs\Climate\SIM2\csv", 
    to_file = True
    )
Exporting...
   _ Success: The data has been exported to the file 'E:\Inputs\Climate\SIM2\csv\SIM2_stz.nc'
<xarray.Dataset> Size: 2GB
Dimensions:        (time: 518, y: 134, x: 143)
Coordinates:
  * time           (time) datetime64[ns] 4kB 1958-08-01 ... 2025-08-20
  * y              (y) int64 1kB 1617000 1625000 1633000 ... 2673000 2681000
  * x              (x) int64 1kB 60000 68000 76000 ... 1180000 1188000 1196000
    spatial_ref    int64 8B 0
Data variables: (12/26)
    PRENEI_Q       (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan
    PRELIQ_Q       (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan
    T_Q            (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan
    FF_Q           (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan
    Q_Q            (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan
    DLI_Q          (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan
            ...
    ECOULEMENT_Q   (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan
    WG_RACINE_Q    (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan
    WGI_RACINE_Q   (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan
    TINF_H_Q       (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan
    TSUP_H_Q       (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan
    PRETOT_Q       (time, y, x) float64 79MB nan nan nan nan ... nan nan nan nan