Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ ci:

repos:
- repo: https://github.com/adamchainz/blacken-docs
rev: "1.18.0"
rev: "1.20.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==24.*]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.6.0"
rev: "v6.0.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand Down Expand Up @@ -45,33 +45,33 @@ repos:
args: [--prose-wrap=always]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.3"
rev: "v0.15.21"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.2
hooks:
- id: codespell
# Checks spelling in `docs/source` dirs ONLY
# Ignores `.ipynb` files and `_build` folders
args: ["--skip=*.ipynb,docs/_build"]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.10.0.1"
rev: "v0.11.0.1"
hooks:
- id: shellcheck

- repo: https://github.com/abravalheri/validate-pyproject
rev: "v0.19"
rev: "v0.25"
hooks:
- id: validate-pyproject
additional_dependencies: ["validate-pyproject-schema-store[all]"]

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.29.2"
rev: "0.37.4"
hooks:
- id: check-dependabot
- id: check-github-workflows
Expand Down
16 changes: 8 additions & 8 deletions docs/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ training, snow-covered area map generation, AOI simplification, canopy-aware
post-processing of snow-covered area (SCA) time series, and validation against
airborne reference snow surveys. Sample data and a pre-trained model are
provided to demonstrate the library's functions. PlanetSCA requires users to
have an account with Planet Data Explorer (https://www.planet.com/explorer/)
and an API key to utilize its search and download capabilities. Limited access
to free PlanetScope images is available at
have an account with Planet Data Explorer (https://www.planet.com/explorer/) and
an API key to utilize its search and download capabilities. Limited access to
free PlanetScope images is available at
https://www.planet.com/industries/education-and-research/.

# Statement of Need
Expand Down Expand Up @@ -135,8 +135,8 @@ A persistent challenge in satellite-based snow detection is the obstruction of
the sensor's view by forest canopy, which can cause snow-covered pixels beneath
dense tree cover to be systematically misclassified as snow-free. PlanetSCA
addresses this through a `post_process` module that provides canopy-aware
spatial infilling of SCA predictions using a canopy height model (CHM).
Forested pixels classified as snow-free are reclassified as snow-covered when a
spatial infilling of SCA predictions using a canopy height model (CHM). Forested
pixels classified as snow-free are reclassified as snow-covered when a
sufficient fraction of their open-area neighbors are snow-covered, with
configurable kernel radius and threshold. The module further provides temporal
median filtering applied independently to forested and open pixels, nodata
Expand All @@ -145,9 +145,9 @@ day-since-disappearance (DSD) dates for characterizing snowmelt timing. A
complementary `validate` module supports quantitative evaluation of PlanetSCA
predictions against Airborne Snow Observatory (ASO) lidar-derived reference
data, computing standard binary classification metrics (precision, recall,
F1-score, accuracy, and Cohen's kappa) and producing a four-class
snow-by-canopy validation raster for stratified assessment of model performance
in forested versus open terrain.
F1-score, accuracy, and Cohen's kappa) and producing a four-class snow-by-canopy
validation raster for stratified assessment of model performance in forested
versus open terrain.

# Acknowledgements

Expand Down
18 changes: 9 additions & 9 deletions src/planetsca/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,15 +508,15 @@ def validation_tif_4class(
)
chm_binary = chm_tif.squeeze()

assert (
aso_binary.shape == chm_binary.shape
), "ASO and CHM rasters must have the same shape"
assert (
aso_binary.rio.crs == chm_binary.rio.crs
), "ASO and CHM rasters must have the same CRS"
assert (
aso_binary.rio.transform() == chm_binary.rio.transform()
), "ASO and CHM rasters must have the same transform"
assert aso_binary.shape == chm_binary.shape, (
"ASO and CHM rasters must have the same shape"
)
assert aso_binary.rio.crs == chm_binary.rio.crs, (
"ASO and CHM rasters must have the same CRS"
)
assert aso_binary.rio.transform() == chm_binary.rio.transform(), (
"ASO and CHM rasters must have the same transform"
)

combined = np.full(aso_binary.shape, np.nan, dtype=np.float32)
combined[(aso_binary == 0) & (chm_binary == 1)] = 0
Expand Down
Loading