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

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

Open
zarrarkhan opened this issue Apr 20, 2024 · 1 comment
Open

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

zarrarkhan opened this issue Apr 20, 2024 · 1 comment
Assignees

Comments

@zarrarkhan
Copy link
Collaborator

@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
@crvernon
Copy link
Member

Thanks @zarrarkhan! I'll check this out ASAP.

@crvernon crvernon self-assigned this Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants