onehealth_db.inout module⚓︎
onehealth_db.inout
⚓︎
Functions:
-
download_data
–Download data from Copernicus's CDS using the cdsapi.
-
get_filename
–Get file name based on dataset name, base name, years, months and area.
-
save_to_netcdf
–Save data to a NetCDF file.
download_data
⚓︎
Download data from Copernicus's CDS using the cdsapi.
Parameters:
-
output_file
(Path
) –The path to the output file where data will be saved.
-
dataset
(str
) –The name of the dataset to download.
-
request
(dict
) –A dictionary containing the request parameters.
get_filename
⚓︎
get_filename(ds_name, data_format, years, months, has_area, base_name='era5_data', variable=['2m_temperature'])
Get file name based on dataset name, base name, years, months and area.
Parameters:
-
ds_name
(str
) –Dataset name.
-
data_format
(str
) –Data format (e.g., "netcdf", "grib").
-
years
(list
) –List of years.
-
months
(list
) –List of months.
-
has_area
(bool
) –Flag indicating if area is included.
-
base_name
(str
, default:'era5_data'
) –Base name for the file. Default is "era5_data".
-
variable
(list
, default:['2m_temperature']
) –List of variables. Default is ["2m_temperature"].
Returns:
-
str
(str
) –Generated file name.
save_to_netcdf
⚓︎
Save data to a NetCDF file.
Parameters:
-
data
(DataArray
) –Data to be saved.
-
filename
(str
) –The name of the output NetCDF file.
-
encoding
(dict
, default:None
) –Encoding options for the NetCDF file.