Skip to content

Allowed global_region to have different resolutions #277

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

Merged
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
11 changes: 6 additions & 5 deletions csep/core/regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,19 @@ def nz_csep_collection_region(dh_scale=1, magnitudes=None, name="csep-nz-collect
def global_region(dh=0.1, name="global", magnitudes=None):
""" Creates a global region used for evaluating gridded forecasts on the global scale.

The gridded region corresponds to the

Args:
dh:
dh (float): Spacing for lat and lon discretization.
name (str): Name of the region
magnitudes(list/array): Array containing the magnitude bins

Returns:
csep.utils.CartesianGrid2D:
csep.utils.CartesianGrid2D: Global region
"""
# generate latitudes

lons = cleaner_range(-180.0, 179.9, dh)
lats = cleaner_range(-90, 89.9, dh)
lons = cleaner_range(-180.0, 180.0, dh)[:-1]
lats = cleaner_range(-90, 90.0, dh)[:-1]
coords = itertools.product(lons,lats)
region = CartesianGrid2D([Polygon(bbox) for bbox in compute_vertices(coords, dh)], dh, name=name)
if magnitudes is not None:
Expand Down