melodies_monet.util.region_select
Masking arbitrary regions with regionmask
Functions
|
Parses region information to return the right type of data. |
|
Selects a region using predefined boundaries. |
|
|
|
Selects a region in whichever format it was provided |
- melodies_monet.util.region_select.control_custom_mask(data, domain_type, domain_info=None, **kwargs)
Parses region information to return the right type of data.
- Parameters:
data (
xr.Dataset) – data to be maskeddomain_type (
str) – type of data. Used to decide which function to apply. Should begin with “custom”.domain_info (
dict) – Dictionary containing relevant information on domain, like url, name, etc.**kwargs – Extra kwargs to pass to regionmask
- Returns:
xr.Dataset– masked Dataset
- melodies_monet.util.region_select.create_autoregion(data, domain_type, domain_name, domain_info=None)
Selects a region using predefined boundaries.
- Parameters:
data (
xr.Dataset | pd.DataFrame) – data to be maskeddomain_type (
str) – type of data. Used to decide which function to apply. If domain_type == ‘auto-region:’, domain_info is required.domain_name (
str) – This is used as the region name, or to read the info.domain_info (
None | dict[str,tuple[float,float,float,float]]) – if not None, dict containing the domain name and a tuple with lonmin, lonmax, latmin, latmax. Only required if domain_type is auto-region:
- Returns:
xr.Dataset | pd.DataFrame– Data as it was provided to the function
- melodies_monet.util.region_select.select_region(data, domain_type, domain_name, domain_info=None, **kwargs)
Selects a region in whichever format it was provided
- Parameters:
data (
xr.Dataset | pd.DataFrame) – data to be maskeddomain_type (
str) – type of data. Used to decide which function to apply.domain_name (
str) – This is used as the region name, or to read the info.domain_info (
dict) – Dict containing the domain_name and other relevant information, e. g., lonlat box, mask_url, mask_file, etc.**kwargs – extra kwargs to pass to the selector, depending on the type of data or region.
- Returns:
xr.Dataset | pd.DataFrame– Region selected. The type will be the same as the input data.