Skip to content

regrid (lines 151-160) in gridded.py may have issues  #71

Description

@zarrarkhan

@crvernon @hassaniazi

Please note that Mengqi & I were trying to use the regrid part of this code for the Building Energy Demand (BED) model and were running into issues when testing line 151-160 in gridded.py. We were performing a manual check on how this chunk was re-gridding examples co-ordinates and we thought it was not working as expected. Someone, should just double check this code again.

if method == 'label':

if method == 'label':
    ds = ds.isel(lon=np.arange(ds.lon.size).repeat(r)).coarsen(lon=s).max()
    ds = ds.isel(lat=np.arange(ds.lat.size).repeat(r)).coarsen(lat=s).max()
else:
    ds = ds.isel(lon=np.arange(ds.lon.size).repeat(r)).coarsen(lon=s).sum()
    ds = ds.isel(lat=np.arange(ds.lat.size).repeat(r)).coarsen(lat=s).sum()
    if method == 'extensive':
        ds = ds / (r * r)  # preserve original sum
    elif method == 'intensive':
        ds = ds / (s * s)  # take average

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions