Skip to content

Commit cf18f52

Browse files
Adds land-sea mask generation (#783)
* Refactors grid generation and updates generating bounds * Fixes dtype in gaussian grid creation * Initial land-sea mask implementation * Fixes exception that occurs when landsea mask resource is missing * Fixes copying mask as it's modified in place by _improve_mask * Fixes returning DataArray from _pcmdi_land_sea_mask * Renames accessor and masking methods * Fixes broken test expecting dataarray * Adds option to output mask in dataset * Adds dispatcher options and updates documentation * Fixes missing import for MaskAccessor * Changes function names and updates docstrings * Adds documentation section for module-level methods * Adds ability to define the source mask to use in the PCMDI land-sea mask generation * Fixes documentation function reference * Refactor land-sea mask handling and documentation - Updated pcmdi_land_sea_mask() docstring and disabled time decoding for navy_land.nc - Replaced bundled navy_land.nc with pooch fetch-and-cache system - Removed mask_get_resource_path() and its tests - Added _data._get_pcmdi_mask_path() with corresponding tests - Updated environment configs to require pooch >=1.8 - Refreshed related docstrings * Moves land/sea mask from geomask to spatial accessor, exposes generate method * Fixes generating mask for a grid * Adds land/sea mask example * Updates landsea mask notebook * Re-run notebook to remove env error * Address Copilot review comments * Renames criteria to threshold and corrects documentation via copilot review --------- Co-authored-by: tomvothecoder <tomvothecoder@gmail.com>
1 parent b7b27aa commit cf18f52

File tree

15 files changed

+2565
-71
lines changed

15 files changed

+2565
-71
lines changed

conda-env/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ dependencies:
1313
- netcdf4
1414
- numpy >=2.0.0,<3.0.0
1515
- pandas
16+
- pooch >=1.8
1617
- python-dateutil
18+
- regionmask
1719
- scipy
1820
- sparse
1921
- xarray >=2024.03.0
@@ -26,4 +28,3 @@ dependencies:
2628
# ==================
2729
- pytest
2830
- pytest-cov
29-
- pooch # Required for xarray tutorial data

conda-env/dev.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ dependencies:
1313
- netcdf4
1414
- numpy >=2.0.0,<3.0.0
1515
- pandas
16+
- pooch >=1.8
1617
- python-dateutil
18+
- regionmask
1719
- scipy
1820
- sparse
1921
- xarray >=2024.03.0
@@ -34,7 +36,6 @@ dependencies:
3436
- pandoc
3537
- ipython # Required for nbsphinx syntax highlighting
3638
- gsw-xarray # Required for vertical regridding example
37-
- pooch # Required for xarray tutorial data
3839
# Quality Assurance
3940
# ==================
4041
- types-python-dateutil
59.1 KB
Loading

docs/api.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ Below is a list of top-level API functions that are available in ``xcdat``.
3939
create_zonal_grid
4040
tutorial.open_dataset
4141

42+
Module-level API Functions
43+
--------------------------
44+
45+
Below is a list of module-level API functions that are available in ``xcdat``.
46+
47+
.. autosummary::
48+
:toctree: generated/
49+
50+
mask.pcmdi_land_sea_mask
51+
52+
4253
Accessors
4354
---------
4455

@@ -123,6 +134,9 @@ Methods
123134
Dataset.bounds.get_bounds
124135
Dataset.bounds.add_missing_bounds
125136
Dataset.spatial.average
137+
Dataset.spatial.mask_land
138+
Dataset.spatial.mask_sea
139+
Dataset.spatial.generate_land_sea_mask
126140
Dataset.temporal.average
127141
Dataset.temporal.group_average
128142
Dataset.temporal.climatology

0 commit comments

Comments
 (0)