-
Notifications
You must be signed in to change notification settings - Fork 2
fix few issues with byc #56
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -443,10 +443,11 @@ def _linear_weights_cropped_domain( | |
"""Crop the grid to output domain.""" | ||
xmin, ymin = np.min(pts_dst, axis=0) - buffer | ||
xmax, ymax = np.max(pts_dst, axis=0) + buffer | ||
|
||
x, y = np.transpose(pts_src) | ||
mask = (xmin < x) & (x < xmax) & (ymin < y) & (y < ymax) | ||
[idx] = np.nonzero(mask) | ||
indices, weights = _linear_weights(np.extract(mask, pts_src), pts_dst) | ||
indices, weights = _linear_weights(pts_src[mask], pts_dst) | ||
return idx[indices], weights | ||
|
||
|
||
|
@@ -485,11 +486,13 @@ def iconremap( | |
|
||
gx, gy = np.meshgrid(dst.x, dst.y) | ||
transformer_dst = Transformer.from_crs(dst.crs.wkt, utm_crs) | ||
points_dst = transformer_dst.transform(gx.flat, gy.flat) | ||
points_dst = transformer_dst.transform(gy.flat, gx.flat) | ||
|
||
xy = np.array(points_src).T | ||
uv = np.array(points_dst).T | ||
|
||
indices, weights = _linear_weights_cropped_domain(xy, uv) | ||
|
||
return _icon2regular(field, dst, indices, weights) | ||
return _icon2regular(field, dst, indices, weights).assign_coords( | ||
lon=(("y", "x"), gx), lat=(("y", "x"), gy) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be lon or longitude? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this only applies if the dst grid is defined in geolatlon CRS |
||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,9 +35,6 @@ def speed(u: xr.DataArray, v: xr.DataArray) -> xr.DataArray: | |
the horizontal wind speed [m/s]. | ||
|
||
""" | ||
if u.origin_x != 0.0 or v.origin_y != 0.0: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as we transition towards ICON native grid support and or other grids, I think we should decommission the C staggering (i.e. origin_x, origin_y). Still variables will be staggered in z There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless we drop support for COSMO data from the archive, this will need to live on. The meaning of the |
||
raise ValueError("The wind components should not be staggered.") | ||
|
||
name = {"U": "SP", "U_10M": "SP_10M"}[u.parameter["shortName"]] | ||
return xr.DataArray( | ||
np.sqrt(u**2 + v**2), | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which coordinate system are you using for your test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geolatlon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I would rather add
always_xy
to the previous line because this change is breaking support for all CRSs that are in the traditional order