Skip to content

Commit

Permalink
Add ceos metadata (#140)
Browse files Browse the repository at this point in the history
* start adding `extra_reference_date` logic given a reference date json

* Separate reference date functions to parse/search

* fix bad comments

* get ref test working

* allow glob for `cslc_file_list`

* redo logic to allow first date after the requested date for reference

* temp fix due to changing reference- cant use timeseries/

* fix tests for new ref json

* bump last dolphin release

* Add `/identification/average_temporal_coherence`

Copy over more CSLC metadata items

* Add `track_number`, `orbit_direction` from cslc

Closes #127
  • Loading branch information
scottstanie authored Sep 19, 2024
1 parent 0cdfe9c commit 91b8e21
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
20 changes: 19 additions & 1 deletion src/disp_s1/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ def create_output_product(
reference_point=reference_point,
)

# Get summary statistics on the layers for CMR filtering/searching purposes
average_temporal_coherence = io.load_gdal(temp_coh_filename, masked=True).mean()

_create_identification_group(
output_name=output_name,
pge_runconfig=pge_runconfig,
Expand All @@ -281,6 +284,7 @@ def create_output_product(
secondary_start_time=secondary_start_time,
secondary_end_time=secondary_end_time,
footprint_wkt=footprint_wkt,
average_temporal_coherence=average_temporal_coherence,
)

_create_metadata_group(output_name=output_name, pge_runconfig=pge_runconfig)
Expand Down Expand Up @@ -400,6 +404,7 @@ def _create_identification_group(
secondary_start_time: datetime.datetime,
secondary_end_time: datetime.datetime,
footprint_wkt: str,
average_temporal_coherence: float,
) -> None:
"""Create the identification group in the output file."""
with h5netcdf.File(output_name, "a") as f:
Expand Down Expand Up @@ -486,6 +491,15 @@ def _create_identification_group(
" used to create the unwrapped phase."
),
)
_create_dataset(
group=identification_group,
name="average_temporal_coherence",
dimensions=(),
data=average_temporal_coherence,
fillvalue=None,
description="Mean value of valid pixels within temporal_coherence layer.",
attrs={"units": "unitless"},
)


def _create_metadata_group(output_name: Filename, pge_runconfig: RunConfig) -> None:
Expand Down Expand Up @@ -794,11 +808,15 @@ def copy_opera_cslc_metadata(
"""
dsets_to_copy = [
"/metadata/orbit", # Group
"/metadata/processing_information/input_burst_metadata/wavelength",
"/identification/zero_doppler_end_time",
"/identification/zero_doppler_start_time",
"/identification/bounding_polygon",
"/metadata/orbit", # Group
"/identification/look_direction",
"/identification/mission_id",
"/identification/track_number",
"/identification/orbit_direction",
]

with h5py.File(comp_slc_file, "r") as src, h5py.File(output_hdf5_file, "a") as dst:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_pge_runconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ def test_runconfig_yaml_roundtrip(tmp_path, runconfig_minimum):

@pytest.fixture
def hawaii_slc_list():
# "23210": {
# "reference_dates": [
# "23210": [
# "2016-07-08T16:15:44",
# "2017-07-09T16:15:07",
# "2018-07-16T16:15:14",
Expand Down

0 comments on commit 91b8e21

Please sign in to comment.