Loading py/cso_catalogue.py +59 −18 Original line number Diff line number Diff line Loading @@ -9,6 +9,12 @@ # Support steps over year when plotting series of gridded observations. # Define full output filename in settings instead of path only. # # 2022-02, Arjo Segers, Met-Norway # Added option to specify which layer of gridded fields should be plotted. # # 2022-10, Arjo Segers, Met-Norway # Adhoc fix to trap nans in lon/lat arrays in S5p/glyoxal data. # ######################################################################## ### Loading Loading @@ -446,6 +452,13 @@ class CSO_Catalogue( CSO_CatalogueBase ) : # extract corner grids and values: xx,yy,values,attrs = orb.GetTrack( vname ) # adhoc, some chocho files have nans in lon/lat bound arrays, # these are still present because the scan line has some valid values ... if numpy.any( numpy.isnan(xx) ) : logging.warning( ' found nans in track corners, skip ...' ) break # leave loop over variables #endif # squeeze if len(values.shape) > 2 : # remove lenth-1 dim "retr" from dims: (scan,pixel,retr) Loading Loading @@ -790,6 +803,13 @@ class CSO_SimCatalogue( CSO_CatalogueBase ) : raise Exception #endif # adhoc, some chocho files have nans in lon/lat bound arrays, # these are still present because the scan line has some valid values ... if numpy.any( numpy.isnan(xx) ) : logging.warning( ' found nans in track corners, skip ...' ) break # leave loop over variables #endif # squeeze shp = values.shape if len(shp) != 2 : Loading Loading @@ -895,6 +915,10 @@ class CSO_GriddedCatalogue( CSO_CatalogueBase ) : <rcbase>.var.yr.source : yr <rcbase>.var.yr.source : ys Optionally specify a source layer for profiles, default is first layer:: <rcbase>.var.yr.source_layer : 0 Optionally specify target units that are different from the input:: ! convert units: Loading Loading @@ -1060,6 +1084,8 @@ class CSO_GriddedCatalogue( CSO_CatalogueBase ) : vkey = 'var.%s' % varname # originating variable: vsource = self.GetSetting( vkey+'.source' ) # optional layer selection: vsource_layer = self.GetSetting( vkey+'.source_layer', totype='int', default=0 ) # target units: vunits = self.GetSetting( vkey+'.units' , default='None' ) # plot type: Loading Loading @@ -1090,6 +1116,21 @@ class CSO_GriddedCatalogue( CSO_CatalogueBase ) : # data: values = vda.values.squeeze() # select layer if needed .. if len(values.shape) == 3 : # check .. if (vsource_layer < 0) or (values.shape[2] < vsource_layer+1) : logging.error( 'could not extract source layer %i from values with shape (%s)' % (vsource_layer,str(vvalues.shape)) ) raise Exception #endif # extract: values = values[:,:,vsource_layer] # elif len(values.shape) != 2 : logging.error( 'could not plot map of array with shape (%s)' % (str(values.shape)) ) raise Exception #endif # adhoc fix, convert to masked array ... values = numpy.ma.array( data=values, mask=numpy.isnan(values) ) Loading Loading
py/cso_catalogue.py +59 −18 Original line number Diff line number Diff line Loading @@ -9,6 +9,12 @@ # Support steps over year when plotting series of gridded observations. # Define full output filename in settings instead of path only. # # 2022-02, Arjo Segers, Met-Norway # Added option to specify which layer of gridded fields should be plotted. # # 2022-10, Arjo Segers, Met-Norway # Adhoc fix to trap nans in lon/lat arrays in S5p/glyoxal data. # ######################################################################## ### Loading Loading @@ -446,6 +452,13 @@ class CSO_Catalogue( CSO_CatalogueBase ) : # extract corner grids and values: xx,yy,values,attrs = orb.GetTrack( vname ) # adhoc, some chocho files have nans in lon/lat bound arrays, # these are still present because the scan line has some valid values ... if numpy.any( numpy.isnan(xx) ) : logging.warning( ' found nans in track corners, skip ...' ) break # leave loop over variables #endif # squeeze if len(values.shape) > 2 : # remove lenth-1 dim "retr" from dims: (scan,pixel,retr) Loading Loading @@ -790,6 +803,13 @@ class CSO_SimCatalogue( CSO_CatalogueBase ) : raise Exception #endif # adhoc, some chocho files have nans in lon/lat bound arrays, # these are still present because the scan line has some valid values ... if numpy.any( numpy.isnan(xx) ) : logging.warning( ' found nans in track corners, skip ...' ) break # leave loop over variables #endif # squeeze shp = values.shape if len(shp) != 2 : Loading Loading @@ -895,6 +915,10 @@ class CSO_GriddedCatalogue( CSO_CatalogueBase ) : <rcbase>.var.yr.source : yr <rcbase>.var.yr.source : ys Optionally specify a source layer for profiles, default is first layer:: <rcbase>.var.yr.source_layer : 0 Optionally specify target units that are different from the input:: ! convert units: Loading Loading @@ -1060,6 +1084,8 @@ class CSO_GriddedCatalogue( CSO_CatalogueBase ) : vkey = 'var.%s' % varname # originating variable: vsource = self.GetSetting( vkey+'.source' ) # optional layer selection: vsource_layer = self.GetSetting( vkey+'.source_layer', totype='int', default=0 ) # target units: vunits = self.GetSetting( vkey+'.units' , default='None' ) # plot type: Loading Loading @@ -1090,6 +1116,21 @@ class CSO_GriddedCatalogue( CSO_CatalogueBase ) : # data: values = vda.values.squeeze() # select layer if needed .. if len(values.shape) == 3 : # check .. if (vsource_layer < 0) or (values.shape[2] < vsource_layer+1) : logging.error( 'could not extract source layer %i from values with shape (%s)' % (vsource_layer,str(vvalues.shape)) ) raise Exception #endif # extract: values = values[:,:,vsource_layer] # elif len(values.shape) != 2 : logging.error( 'could not plot map of array with shape (%s)' % (str(values.shape)) ) raise Exception #endif # adhoc fix, convert to masked array ... values = numpy.ma.array( data=values, mask=numpy.isnan(values) ) Loading