TNO Intern

Commit 9e6159d7 authored by Arjo Segers's avatar Arjo Segers
Browse files

Fixed bug in S5P orbit selection.

parent c8a14d51
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -254,3 +254,11 @@ Migration from Copernicus SciHub to DataSpace.
  doc/source/*
  py/*
  config/*


Patch 2.5.1
~~~~~~~~~~~

Fixed bug in S5P orbit selection.
  py/cso_s5p.py
+12 −8
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@
#   or are corrupted, next to message files that inform about zero selected pixels.
#   Use download object to avoid errors on token creation.
#
# 2023-12, Arjo Segers
#   Fixed bug in orbit selection.
#

########################################################################
###
@@ -2264,9 +2267,9 @@ class CSO_S5p_Convert(utopya.UtopyaRc):
        #     (%{processor_version} == '020400') & (%{processing} == 'RPRO') ; ...
        line = self.GetSetting("selection")
        # replace templates:
        #     (rec['processor_version'] == '020400') & (rec['processing'] == 'RPRO') ; ...
        #     (xrec['processor_version'] == '020400') & (xrec['processing'] == 'RPRO') ; ...
        for key in df.keys():
            line = line.replace("%{" + key + "}", "rec['" + key + "']")
            line = line.replace("%{" + key + "}", "xrec['" + key + "']")
        # endfor
        # split:
        selections = line.split(";")
@@ -2335,16 +2338,17 @@ class CSO_S5p_Convert(utopya.UtopyaRc):
                # make empty again:
                selected = []
                # loop over records:
                for indx, rec in odf.iterrows():
                for indx, xrec in odf.iterrows():
                    # skip?
                    if os.path.basename(rec["filename"]) in blacklist:
                        filestatus[rec["filename"]] = "blacklisted"
                    if os.path.basename(xrec["filename"]) in blacklist:
                        filestatus[xrec["filename"]] = "blacklisted"
                        continue
                    # endif
                    # evaluate expression including 'rec[key]' values:
                    # evaluate expression including 'xrec[key]' values:
                    if eval(selection):
                        selected.append(rec["filename"])
                        filestatus[rec["filename"]] = "selected"
                        selected.append(xrec["filename"])
                        filestatus[xrec["filename"]] = "selected"
                        rec = xrec
                    # endif
                # endfor # records
                # exactly one? then leave: