w4h.export module

The Export module contains functions for exporting processed data.

w4h.export.export_dataframe(df, out_dir, filename, date_stamp=True, log=False)[source]

Function to export dataframes

Parameters:
dfpandas dataframe, or list of pandas dataframes

Data frame or list of dataframes to be exported

out_dirstring or pathlib.Path object

Directory to which to export dataframe object(s) as .csv

filenamestr or list of strings

Filename(s) of output files

date_stampbool, default=True

Whether to include a datestamp in the filename. If true, file ends with _yyyy-mm-dd.csv of current date, by default True.

logbool, default = True

Whether to log inputs and outputs to log file.

w4h.export.export_grids(grid_data, out_path, file_id='', filetype='tif', variable_sep=True, date_stamp=True, verbose=False, log=False)[source]

Function to export grids to files.

Parameters:
grid_dataxarray DataArray or xarray Dataset

Dataset or dataarray to be exported

out_pathstr or pathlib.Path object

Output location for data export. If variable_sep=True, this should be a directory. Otherwise, this should also include the filename. The file extension should not be included here.

file_idstr, optional

If specified, will add this after ‘LayerXX’ or ‘AllLayers’ in the filename, just before datestamp, if used. Example filename for file_id=’Coarse’: Layer1_Coarse_2023-04-18.tif.

filetypestr, optional

Output filetype. Can either be pickle or any file extension supported by rioxarray.rio.to_raster(). Can either include period or not., by default ‘tif’

variable_sepbool, optional

If grid_data is an xarray Dataset, this will export each variable in the dataset as a separate file, including the variable name in the filename, by default False

date_stampbool, optional

Whether to include a date stamp in the file name., by default True

logbool, default = True

Whether to log inputs and outputs to log file.