Skip to content

Generalize csBin to include LatLon binning as well #68

Open
@amdasilva

Description

@amdasilva

Current status

The module csBin provides a pure python implementation for binning observations to a cubed sphere grid.

Enhancement 1: option for sum instead of average in binObs()

Add an optional parameter average:

def binObs ( self, obs, average=True )

By default average=True and the binned observations are averaged by dividing by nobs. If average=False, skip the normalization in line 260

Enhancement 2: Add LatLon binning functionality.

Because we may want to generalize this in the future for future grids, let's rename file csBin.py simply binning.py. In addition to the CSBIN class, now add:

class LLBIN(object):
   def __init__(self, lon, lat):
   def __init__(self, lon_bnds, lat_bnds):

where lon(), lat() are 1D arrays defining the lat/lon grid centers, lon_bnds, lat_bnds being the bounds, Some considerations:

  • assume the longitude grid to be global and periodic for now with values between -180 and 180; check and raise exception if this is violated.
  • latitudes do not need to be uniform, so it could support gaussian grids
  • latitude grid could be pole centered or not
  • if bounds are provided (lon_bnds, lat_bnds) use them; if not derive from (lon,lat)
  • resulting binned obs should x(lat,lon)

Support methods setIndices() and binObs() as in CSBIN, including Enhancement 1 above. You may want to rename this:

class BinningError(Exception):
    """
    Defines general exception errors.
    """
    def __init__(self, value):
        self.value = value
    def __str__(self):
        return repr(self.value)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions