umr-lops / grdwindinversion

python library to compute wind speed from GRD SAR images
https://cerweb.ifremer.fr/datarmor/doc_sphinx/grdwindinversion/index.html
MIT License
6 stars 1 forks source link

Auxiliary dir error : TypeError: expected str, bytes or os.PathLike object, not NoneType #52

Closed Skealz closed 1 week ago

Skealz commented 4 months ago

When processing

/home/datawork-cersat-public/cache/project/mpc-sentinel1/data/esa/sentinel-1a/L1/IW/S1A_IW_GRDH_1S/2023/297/S1A_IW_GRDH_1SDV_20231024T004708_20231024T004737_050900_0622AE_3F98.SAFE

11/02/2024 06:23:15 INFO inversion.py(493) Traceback (most recent call last):
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/2024v2v1_0v9_0v2v3vpost6_1v0v7_1v0v6_1v0v5_1v1v11_1v0v1_1v0v1/grdwindinversion/lib/python3.10/site-packages/grdwindinversion/inversion.py", line 467, in makeL2
    xsar_dataset = fct_dataset(
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/2024v2v1_0v9_0v2v3vpost6_1v0v7_1v0v6_1v0v5_1v1v11_1v0v1_1v0v1/grdwindinversion/lib/python3.10/site-packages/xsar/sentinel1_dataset.py", line 289, in __init__
    self.add_high_resolution_variables(
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/2024v2v1_0v9_0v2v3vpost6_1v0v7_1v0v6_1v0v5_1v1v11_1v0v1_1v0v1/grdwindinversion/lib/python3.10/site-packages/xsar/sentinel1_dataset.py", line 476, in add_high_resolution_variables
    self.add_gains(config["auxiliary_names"][self.sar_meta.short_name.split(":")[-2][0:3]][self.aux_config_name]["AUX_CAL"],
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/2024v2v1_0v9_0v2v3vpost6_1v0v7_1v0v6_1v0v5_1v1v11_1v0v1_1v0v1/grdwindinversion/lib/python3.10/site-packages/xsar/sentinel1_dataset.py", line 566, in add_gains
    path_aux_cal_new = get_path_aux_cal(new_aux_cal_name)
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/2024v2v1_0v9_0v2v3vpost6_1v0v7_1v0v6_1v0v5_1v1v11_1v0v1_1v0v1/grdwindinversion/lib/python3.10/site-packages/xsar/utils.py", line 768, in get_path_aux_cal
    path = os.path.join(config["auxiliary_dir"],
  File "/home/datawork-cersat-public/cache/project/sarwing/commits/2024v2v1_0v9_0v2v3vpost6_1v0v7_1v0v6_1v0v5_1v1v11_1v0v1_1v0v1/grdwindinversion/lib/python3.10/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
Skealz commented 4 months ago

I got this error when using a non-default config file, which content is :

S1A:
    GMF_VV_NAME: "cmod5n"
    GMF_VH_NAME: "gmf_s1_v2"
    dsig_VH_NAME: "gmf_s1_v2"
    apply_flattening: True
    recalibration: True
    aux_config_name: "v_IPF_36"
S1B:
    GMF_VV_NAME: "cmod5n"
    GMF_VH_NAME: "gmf_s1_v2"
    dsig_VH_NAME: "gmf_s1_v2"
    apply_flattening: True
    recalibration: True
    aux_config_name: "v_IPF_36"
RS2:
    GMF_VV_NAME: "cmod5n"
    GMF_VH_NAME: "gmf_rs2_v2"
    dsig_VH_NAME: "gmf_rs2_v2"
    apply_flattening: False
    recalibration: True
    aux_config_name: "v_IPF_36"
RCM:
    GMF_VV_NAME: "cmod5n"
    GMF_VH_NAME: "gmf_rcm_noaa"
    dsig_VH_NAME: "gmf_s1_v2"
    apply_flattening: True
    recalibration: True
    aux_config_name: "v_IPF_36"

The content is the same a the example recal config file in the repo, the only difference is that it is not located inside the project directory.

Skealz commented 4 months ago

In fact it just seems that "auxiliary_dir" is missing from my xsar config.

In fact, the default xsar config is used, and by default the auxiliary_dir in the default config is empty.

It doesn't seem it exists a mecanism to specify a xsar config through grdwindinversion. Maybe it should ? It looks like the only way to specify a config in xsar is by setting a file inside ~/.xsar or in the xsar package dir. It seems to me it would be better to also provide it through functions ?