Skip to content

Commit

Permalink
add exception for S1 & RS2 too
Browse files Browse the repository at this point in the history
  • Loading branch information
vincelhx committed Dec 10, 2024
1 parent c0821ea commit b2e15ca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions grdwindinversion/inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ def getOutputName(input_file, outdir, sensor, meta_start_date, meta_stop_date, s
template = string.Template(
"${MISSIONID}_${BEAM}_${PRODUCT}${RESOLUTION}_${LEVEL}${CLASS}${POL}_${STARTDATE}_${STOPDATE}_${ORBIT}_${TAKEID}_${PRODID}.SAFE")
match = regex.match(basename_match)
if not match:
raise AttributeError(
f"S1 file {basename_match} does not match the expected pattern")

MISSIONID, BEAM, PRODUCT, RESOLUTION, LEVEL, CLASS, POL, STARTDATE, STOPDATE, ORBIT, TAKEID, PRODID = match.groups()
new_format = f"{MISSIONID.lower()}-{BEAM.lower()}-owi-xx-{STARTDATE.lower()}-{STOPDATE.lower()}-{ORBIT}-{TAKEID}.nc"
elif sensor == 'RS2':
Expand All @@ -95,6 +99,10 @@ def getOutputName(input_file, outdir, sensor, meta_start_date, meta_stop_date, s
template = string.Template(
"${MISSIONID}_OK${DATA1}_PK${DATA2}_DK${DATA3}_${DATA4}_${DATE}_${TIME}_${POLARIZATION}_${LAST}")
match = regex.match(basename_match)
if not match:
raise AttributeError(
f"RC2 file {basename_match} does not match the expected pattern")

MISSIONID, DATA1, DATA2, DATA3, DATA4, DATE, TIME, POLARIZATION, LAST = match.groups()
new_format = f"{MISSIONID.lower()}--owi-xx-{meta_start_date.lower()}-{meta_stop_date.lower()}-_____-_____.nc"
elif sensor == 'RCM':
Expand Down

0 comments on commit b2e15ca

Please sign in to comment.