Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize csBin to include LatLon binning as well #68

Open
amdasilva opened this issue Jan 17, 2025 · 1 comment
Open

Generalize csBin to include LatLon binning as well #68

amdasilva opened this issue Jan 17, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@amdasilva
Copy link
Collaborator

amdasilva commented Jan 17, 2025

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)
@amdasilva amdasilva added the enhancement New feature or request label Jan 17, 2025
@weiyuan-jiang
Copy link
Contributor

Can lat lon or lat_bnds and lon_bnds be read from files? Please show me an example of the file with lat-lon grid. @amdasilva

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants