Skip to content

Remove ERA-5 fliplat command and assert checks in base_grid.py to sup… #5

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions esmgrids/base_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ def make_corners(x, y, dx, dy):
assert(not np.isnan(np.sum(clat)))

# The bottom latitude band should always be Southern extent.
assert(np.all(clat[0, 0, :] == np.min(y) - dy_half[0, :]))
assert(np.all(clat[1, 0, :] == np.min(y) - dy_half[0, :]))
# assert(np.all(clat[0, 0, :] == np.min(y) - dy_half[0, :]))
# assert(np.all(clat[1, 0, :] == np.min(y) - dy_half[0, :]))

# The top latitude band should always be Northern extent.
assert(np.all(clat[2, -1, :] == np.max(y) + dy_half[-1, :]))
assert(np.all(clat[3, -1, :] == np.max(y) + dy_half[-1, :]))
# assert(np.all(clat[2, -1, :] == np.max(y) + dy_half[-1, :]))
# assert(np.all(clat[3, -1, :] == np.max(y) + dy_half[-1, :]))

return clat, clon, None, None, None, None
2 changes: 1 addition & 1 deletion esmgrids/era5_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, h_grid_def, description='ERA5 regular grid'):
with nc.Dataset(h_grid_def) as f:
x_t = f.variables['longitude'][:]
# ERA5 puts latitudes the wrong way around
y_t = np.flipud(f.variables['latitude'][:])
y_t = f.variables['latitude'][:]

super(Era5Grid, self).__init__(x_t=x_t, y_t=y_t, calc_areas=False,
description=description)
Expand Down