API¶
Marare¶
- marare.marare.alignment(input_dir: str, output_dir: str, excluded: List[str], concurrent_processes: int, crs: str, no_value: str, cutline_path: Optional[str])¶
Align a list of raster files
- Parameters
input_dir (str) – directory containing raster files
output_dir (str) – directory in which aligned files will be saved
excluded (List[str]) – list of subdirectories that are excluded from input_dir
concurrent_processes (int) – number of concurrent threads that cooperate
crs (str) – Coordinate Reference System used for the alignment
no_value (str) – novalue value used for the alignment
cutline_path (Optional[str]) – optional cutline path used for clipping operation
- marare.marare.netcdfs_to_dataset(name_suffixes: List[str], datasets_paths: List[str], destination_dataset_path: str, use_precomputed_scalers: bool, variables_to_normalize: Union[None, dict], scalers_dir: Optional[str], cast_to_float16=False)¶
Merge multiples NetCDF files obtained with stacks_to_netcdf procedure
- Parameters
name_suffixes (List[str]) – suffixes used for variables from different stacks
datasets_paths (List[str]) – list of path for stacks
destination_dataset_path (str) – path where the final dataset will be saved
variables_to_normalize (Union[None, dict]) – optional dictionary that describes the normalization phase. For more information please refer to Merge multiple NetCDF files section of the documentation
scalers_dir (Union[str, None]) – optional directory where scales and offsets of normalization will be saved
cast_to_float16 (bool) – optional flag for internal cast to float16 (can be used to save space)
- marare.marare.stack(input_dir: str, output_stack: str, concurrent_processes: int, merge_type: str, name_band: Union[None, str], coord_name: Union[None, str], order: Union[None, List[str]], date_extraction_regex: Union[None, str], date_conversion_pattern: Union[None, str], cutline_path: Optional[str], cutline_crs: Optional[str])¶
Crete a single stack (as a NetCDF file) from a list of raster files
- Parameters
input_dir (str) – directory containing the list of raster files
output_stack (str) – path where the computed NetCDF file will be saved
concurrent_processes (int) – number of concurrent threads that cooperate
merge_type (str) – type of merge used for the stack operation. Allowed types are gdal or xarray. For more information about their usage please refer to the documentation section about stack creation
name_band (str) – name associated to the variable of the final NetCDF file
coord_band (str) – name associated to the third coordinate of variable with name_band name of the final NetCDF file
order (Union[None, List[str]]) – optional list of str that defines the subdirectories order for the stack creation
date_extraction_regex (Union[None, str]) – regex used to extract datetime from filename of rasters. Used only with xarray merge type. For more information about their usage please refer to the documentation section about stack creation
date_conversion_pattern (Union[None, str]) – pattern used for datetime.strptime method to convert extracted dt to a coordinate for the variable with the name name_band. Used only with xarray merge type. For more information about their usage please refer to the documentation section about stack creation
cutline_path (Union[str, None]) – optional cutline path used for clipping operation
cutline_crs (Union[str, None]) – CRS used to load the optional file for clipping opreation
- marare.marare.stacks_to_netcdf(names: List[str], stacks: List[str], output_path: str)¶
Merge multiple NetCDF stacks into a single NetCDF file
- Parameters
names (List[str]) – names used for variables
stacks (List[str]) – list of datasets paths
output_path (str) – path where the merged NetCDF file will be saved