opera-adt / DSWX-SAR

Dynamic Surface Water Extent from Synthetic Aperture Radar
Apache License 2.0
10 stars 6 forks source link

Is the Layover Mask name correct or am I missing something in the Runconfig? #26

Closed cmarshak closed 8 months ago

cmarshak commented 10 months ago

Is this the correct mask name for v1.0 products?

https://github.com/opera-adt/DSWX-SAR/blob/main/src/dswx_sar/mosaic_rtc_burst.py#L775

The files I have from HySDS are named something like:

OPERA_L2_RTC-S1_T034-071100-IW3_20211212T002833Z_20230929T210202Z_S1B_30_v1.0_mask.tif

So, when I run:

cfg = RunConfig.load_from_yaml('tmp.yml', 'dswx_s1', args)
dswx_s1_workflow(cfg)

I get the error:

Number of bursts to process: 10
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[425], line 1
----> 1 dswx_s1_workflow(cfg)

File ~/mambaforge/envs/dswx_val/lib/python3.11/site-packages/dswx_sar/dswx_s1.py:34, in dswx_s1_workflow(cfg)
     31 logger.info(f"Polarizations : {pol_list}")
     33 # Create mosaic burst RTCs
---> 34 mosaic_rtc_burst.run(cfg)
     36 # preprocessing (relocating ancillary data and filtering)
     37 pre_processing.run(cfg)

File ~/mambaforge/envs/dswx_val/lib/python3.11/site-packages/dswx_sar/mosaic_rtc_burst.py:787, in run(cfg)
    785         mask_name = 'layoverShadowMask'
    786     else:
--> 787         raise FileNotFoundError
    789 save_h5_metadata_to_tif(metadata_path,
    790                         data_path=f'{freqA_path}/{mask_name}',
    791                         output_tif_path=temp_mask_path,
    792                         epsg_output=epsg_output)
    793 mask_list.append(temp_mask_path)

FileNotFoundError: 

Here is the sample runconfig:

runconfig:
  groups:
    dynamic_ancillary_file_group:
      algorithm_parameters: params.yml
      dem_file: /Users/cmarshak/bekaert-team/dswx-sar-workflow-pst/out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/glo30_dem.tif
      dem_file_description:
      hand_file: /Users/cmarshak/bekaert-team/dswx-sar-workflow-pst/out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/hand.tif
      hand_file_description:
      reference_water_file: /Users/cmarshak/bekaert-team/dswx-sar-workflow-pst/out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/pekel_occ.tif
      reference_water_file_description:
      shoreline_shapefile:
      shoreline_shapefile_description:
      worldcover_file: /Users/cmarshak/bekaert-team/dswx-sar-workflow-pst/out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/wc.tif
      worldcover_file_description:
    input_file_group:
      input_file_path:
      - out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/rtc_products/OPERA_L2_RTC-S1_T034-071099-IW1_20211212T002829Z_20230929T210202Z_S1B_30_v1.0/
      - out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/rtc_products/OPERA_L2_RTC-S1_T034-071100-IW3_20211212T002833Z_20230929T210202Z_S1B_30_v1.0/
      - out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/rtc_products/OPERA_L2_RTC-S1_T034-071095-IW2_20211212T002819Z_20230929T105227Z_S1B_30_v1.0/
      - out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/rtc_products/OPERA_L2_RTC-S1_T034-071096-IW1_20211212T002820Z_20230929T105227Z_S1B_30_v1.0/
      - out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/rtc_products/OPERA_L2_RTC-S1_T034-071100-IW1_20211212T002831Z_20230929T210202Z_S1B_30_v1.0/
      - out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/rtc_products/OPERA_L2_RTC-S1_T034-071097-IW1_20211212T002823Z_20230929T210202Z_S1B_30_v1.0/
      - out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/rtc_products/OPERA_L2_RTC-S1_T034-071095-IW1_20211212T002818Z_20230929T210202Z_S1B_30_v1.0/
      - out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/rtc_products/OPERA_L2_RTC-S1_T034-071097-IW3_20211212T002825Z_20230929T210202Z_S1B_30_v1.0/
      - out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/rtc_products/OPERA_L2_RTC-S1_T034-071098-IW1_20211212T002826Z_20230929T105227Z_S1B_30_v1.0/
      - out/S1B_IW_SLC__1SDV_20211212T002818_20211212T002836_029985_03946A_6D2A/rtc_products/OPERA_L2_RTC-S1_T034-071100-IW2_20211212T002832Z_20230929T105227Z_S1B_30_v1.0/
    log_file: None
    pge_name_group:
      pge_name: DSWX_S1_PGE
    primary_executable:
      product_type: dswx_s1
    product_path_group:
      output_imagery_compression: DEFLATE
      output_imagery_format: COG
      output_imagery_nbits: 32
      product_path: product_path
      product_version:
      sas_output_path: sas_out
      scratch_path: scratch
    static_ancillary_file_group:
      mgrs_collection_database_file:
      mgrs_database_file:
      static_ancillary_inputs_flag: false
  name: dswx_s1_workflow_default
oberonia78 commented 10 months ago

Hi @cmarshak Thank you for pointing this out. Probably, this issue is related to the RTC version. Previously, the RTC algorithm saved the layover/shadow mask into the HDF5 file or Geotiff ending with layover_shadow_mask. I'll correct this based on your PR, also add a few changes as well.