Loading py/cso_s5p.py +54 −0 Original line number Diff line number Diff line Loading @@ -2143,6 +2143,60 @@ class CSO_S5p_File(cso_file.CSO_File): # enddef AddSelection # * def ResetLongitudeBounds(self, data): """ Reset longitudes in ``(scan,pixel,corner)`` array such that they form a contineous series without jumps when passing the date line. """ # modules: import numpy # storage for output: values = data.copy() # shape: ns, np, nc = data.shape # loop over corners: for ic in range(nc): # loop over scan lines: for j in range(ns): # quick check: if numpy.any(abs(values[j, :, ic] - values[j, 0, ic]) > 180.0): # loop over pixels, start with second: for i in range(1, np): # crossing dateline? reset this and following values: if values[j, i, ic] - values[j, i - 1, ic] > 180.0: values[j, i:, ic] -= 360.0 elif values[j, i, ic] - values[j, i - 1, ic] < -180.0: values[j, i:, ic] += 360.0 # endif # endfor # endif # compare first pixel with previous scan line: if j > 0: # crossing dateline? reset this line and following values: if values[j, 0, ic] - values[j - 1, 0, ic] > 180.0: values[j:, :, ic] -= 360.0 elif values[j, 0, ic] - values[j - 1, 0, ic] < -180.0: values[j:, :, ic] += 360.0 # endif # endif # endfor # j # endfor # ic # ok: return values # enddef ResetLongitudeBounds # endclass CSO_S5p_File Loading Loading
py/cso_s5p.py +54 −0 Original line number Diff line number Diff line Loading @@ -2143,6 +2143,60 @@ class CSO_S5p_File(cso_file.CSO_File): # enddef AddSelection # * def ResetLongitudeBounds(self, data): """ Reset longitudes in ``(scan,pixel,corner)`` array such that they form a contineous series without jumps when passing the date line. """ # modules: import numpy # storage for output: values = data.copy() # shape: ns, np, nc = data.shape # loop over corners: for ic in range(nc): # loop over scan lines: for j in range(ns): # quick check: if numpy.any(abs(values[j, :, ic] - values[j, 0, ic]) > 180.0): # loop over pixels, start with second: for i in range(1, np): # crossing dateline? reset this and following values: if values[j, i, ic] - values[j, i - 1, ic] > 180.0: values[j, i:, ic] -= 360.0 elif values[j, i, ic] - values[j, i - 1, ic] < -180.0: values[j, i:, ic] += 360.0 # endif # endfor # endif # compare first pixel with previous scan line: if j > 0: # crossing dateline? reset this line and following values: if values[j, 0, ic] - values[j - 1, 0, ic] > 180.0: values[j:, :, ic] -= 360.0 elif values[j, 0, ic] - values[j - 1, 0, ic] < -180.0: values[j:, :, ic] += 360.0 # endif # endif # endfor # j # endfor # ic # ok: return values # enddef ResetLongitudeBounds # endclass CSO_S5p_File Loading