Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-publication DEA Intertidal updates #79

Merged
merged 13 commits into from
Mar 25, 2024
Merged

Pre-publication DEA Intertidal updates #79

merged 13 commits into from
Mar 25, 2024

Conversation

robbibt
Copy link
Member

@robbibt robbibt commented Mar 24, 2024

Many changes here in the leadup to version 1.0.0:

Extents:

  • Temporarily remove Extents processing pending releasing it in next release
  • Remove Extents masking of "ta" tide attribute layers

Elevation and exposure

  • Add ocean connectivity mask to remove elevation values over inland non-tidal waters
  • Divide uncertainty by 2.0 to become one-sided uncertainty

CLI and packaging

  • Add seasonality correction as CLI flag
  • Fixed metadata bug that was causing tiles with NaN tide range to be assigned "macrotidal"
  • Renamed "intertidal_category" metadata field to "tr_class" (to match existing "tr" metadata field)

Other

Copy link

For full integration test results, refer to the Tests directory README.

@robbibt robbibt linked an issue Mar 25, 2024 that may be closed by this pull request
RUN pip-compile --extra-index-url=https://packages.dea.ga.gov.au/ --output-file=/conf/requirements.txt /conf/requirements.in
# COPY requirements.in /conf/
# RUN pip-compile --extra-index-url=https://packages.dea.ga.gov.au/ --output-file=/conf/requirements.txt /conf/requirements.in
COPY requirements.txt /conf/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a precompiled requirements.txt file rather than creating it on the fly - much faster! We just need to run this manually when we change our inputs

dem_flat_uncertainty = dem_flat_high - dem_flat_low
# Subtract low from high DEM to summarise uncertainty range
# (and divide by two to give one-sided uncertainty)
dem_flat_uncertainty = (dem_flat_high - dem_flat_low) / 2.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Divide uncertainty by 2.0 to get one-sided uncertainty bounds

ocean_connected_mask = ocean_connection(
~(ds.qa_ndwi_freq < min_freq), ocean_mask
)
ds[elevation_bands] = ds[elevation_bands].where(ocean_connected_mask)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any elevation pixels outside of the "connected to ocean" mask are set to NaN

@@ -1067,6 +1088,18 @@ def elevation(
help="Proportion of the tide range to use for each window radius "
"in the per-pixel rolling median calculation, by default 0.15.",
)
@click.option(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will allow us to test seasonality correction in Argo later - off by default

max_freq=max_freq,
min_correlation=min_correlation,
)
# # Calculate extents (to be included in next version)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporarily commented out, will restore in next version

aclum_ds = dc.load(product=product, like=geobox, resampling=resampling).squeeze(
"time"
)
try:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try/except to return an empty array rather than an error if no data is available

@@ -782,12 +844,14 @@ def tidal_metadata(ds):
)

# Calculate category
metadata_dict["intertidal:category"] = (
metadata_dict["intertidal:tr_class"] = (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed for concistency with "tr" tide range metadata field

"microtidal"
if metadata_dict["intertidal:tr"] < 2
else "mesotidal"
if 2 <= metadata_dict["intertidal:tr"] <= 4
else "macrotidal"
if metadata_dict["intertidal:tr"] > 4
else np.nan
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If metadata_dict["intertidal:tr"] was NaN, this used to return "macrotidal". Now it returns NaN too

_write_stac(
dataset_assembler,
destination_path=destination_path,
explorer_base_url=explorer_url,
explorer_base_url="https://explorer.dea.ga.gov.au",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use main Explorer URL always instead of trying to guess it from S3 path (not sure this is used for anything)

if lat_hat:
lat = min_mod.where(valid_mask)
hat = max_mod.where(valid_mask)
lat = min_mod
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just return tide stats as-is without any masking for now

# from rasterio.features import sieve


# def extents_ocean_masking(
Copy link
Member Author

@robbibt robbibt Mar 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Experimental ocean masking version of Extents - not tested at large scale

@robbibt robbibt changed the title DRAFT Pre-publication DEA Intertidal updates Pre-publication DEA Intertidal updates Mar 25, 2024
@robbibt robbibt requested review from erialC-P and vnewey March 25, 2024 06:40
Copy link
Collaborator

@vnewey vnewey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@vnewey vnewey merged commit f0a2f13 into main Mar 25, 2024
@robbibt robbibt deleted the pre_release_updates branch March 25, 2024 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace dynamic Explorer URL determination with hardcoded value
2 participants