icenet.data.sic package¶
Submodules¶
icenet.data.sic.mask module¶
- class icenet.data.sic.mask.Masks(*args, polarhole_dates: object = (datetime.date(1987, 6, 1), datetime.date(2005, 10, 1), datetime.date(2015, 12, 1)), polarhole_radii: object = (28, 11, 3), data_shape: object = (432, 432), dtype: object = <class 'numpy.float32'>, **kwargs)[source]¶
Bases:
Generator
Masking of regions to include/omit in dataset.
TODO: Add example usage.
- LAND_MASK_FILENAME = 'land_mask.npy'¶
- POLARHOLE_DATES = (datetime.date(1987, 6, 1), datetime.date(2005, 10, 1), datetime.date(2015, 12, 1))¶
- POLARHOLE_RADII = (28, 11, 3)¶
- generate(year: int = 2000, save_land_mask: bool = True, save_polarhole_masks: bool = True, remove_temp_files: bool = False)[source]¶
Generate a set of data masks.
- Parameters:
year (optional) – Which year to use for generate masks from. Defaults to 2000.
save_land_mask (optional) – Whether to output land mask. Defaults to True.
save_polarhole_masks (optional) – Whether to output polar hole masks. Defaults to True.
remove_temp_files (optional) – Whether to remove temporary directory. Defaults to False.
- get_active_cell_da(src_da: object) object [source]¶
- Generate an xarray.DataArray object containing the active cell masks
for each timestamp in a given source DataArray.
- Parameters:
src_da – Source xarray.DataArray object containing time, xc, yc coordinates.
- Returns:
- An xarray.DataArray containing active cell masks for each time
in source DataArray.
- get_active_cell_mask(month: object) object [source]¶
Loads an active grid cell mask from numpy file.
Also, checks if a mask file exists for input month, and raises an error if it does not.
- Parameters:
month – Month index representing the month for which the mask file is being checked.
- Returns:
Active cell mask boolean(s) for corresponding month and pre-defined self._region.
- Raises:
RuntimeError – If the mask file for the input month does not exist.
- get_blank_mask() object [source]¶
Returns an empty mask.
- Returns:
- A numpy array of flags set to false for pre-defined self._region
of shape self._shape (the data_shape instance initialisation value).
- get_land_mask(land_mask_filename: str = 'land_mask.npy') object [source]¶
- Generate an xarray.DataArray object containing the active cell masks
for each timestamp in a given source DataArray.
- Parameters:
land_mask_filename (optional) – Land mask output filename. Defaults to Masks.LAND_MASK_FILENAME.
- Returns:
- An numpy array of land mask flag(s) for corresponding month and
pre-defined self._region.
icenet.data.sic.osisaf module¶
- class icenet.data.sic.osisaf.DaskWrapper(dask_port: int = 8888, dask_timeouts: int = 60, dask_tmp_dir: object = '/tmp', workers: int = 8)[source]¶
Bases:
object
- Parameters:
dask_port
dask_timeouts
dask_tmp_dir
workers
- class icenet.data.sic.osisaf.SICDownloader(*args, additional_invalid_dates: object = (), chunk_size: int = 10, dates: object = (), delete_tempfiles: bool = True, download: bool = True, dtype: object = <class 'numpy.float32'>, parallel_opens: bool = True, **kwargs)[source]¶
Bases:
Downloader
Downloads OSI-SAF SIC data from 1979-present using OpenDAP.
The dataset comprises OSI-450 (1979-2015) and OSI-430-b (2016-ownards) Monthly averages are-computed on the server-side. This script can take about an hour to run.
- The query URLs were obtained from the following sites:
- OSI-450 (1979-2016): https://thredds.met.no/thredds/dodsC/osisaf/
met.no/reprocessed/ice/conc_v2p0_nh_agg.html
- OSI-430-b (2016-present): https://thredds.met.no/thredds/dodsC/osisaf/
met.no/reprocessed/ice/conc_crb_nh_agg.html
OSI-430-a (2022-present): https://osi-saf.eumetsat.int/products/osi-430-as
- Parameters:
additional_invalid_dates
chunk_size
dates
delete_tempfiles
download
dtype