-
Notifications
You must be signed in to change notification settings - Fork 15
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
stereographic distortion close to the poles #75
Comments
I think if the results are good (equilateral and matching the edge length that you want) then it's reasonable approach. What happens for a non-global mesh around the poles, like for Arctic circle only? |
Thanks @WPringle, following your post, I realized it didn't work for other resolutions. So I have done some sensitivity tests on the arctic circle and ended up using the following parametric law: def _parametric(lat):
ones = np.ones(lat.shape)
res1 = ((90 - lat) * 2 + 16) / 180 * np.pi
res2 = ((90 - lat) * 4 + 8) / 180 * np.pi
res3 = ((90 - lat) * 8 + 4) / 180 * np.pi
res4 = ((90 - lat) * 16 + 2) / 180 * np.pi
res5 = ((90 - lat) * 32 + 1) / 180 * np.pi
res6 = ((90 - lat) * 64 + 0.5) / 180 * np.pi
res7 = ((90 - lat) * 128 + 0.25) / 180 * np.pi
res8 = ((90 - lat) * 252 + 0.125) / 180 * np.pi
res = np.minimum(res1, ones)
res = np.minimum(res2, res)
res = np.minimum(res3, res)
res = np.minimum(res4, res)
res = np.minimum(res5, res)
res = np.minimum(res6, res)
res = np.minimum(res7, res)
res = np.minimum(res8, res)
return res I have implemented it and also changed the initial point distribution during the mesh generation. I have tested up until 3km, with a uniform mesh size or a varying one. Equilateralness is okayish but I am not sure if I get the right edge length. I guess for now, I will avoid constraining my model with too high resolution at the pole. |
I found out what was the problem. I was actually trying to solve this by the wrong end:
In if stereo:
bbox = np.array([[-180, 180], [-89, 89]])
p = np.mgrid[tuple(slice(min, max + min_edge_length, min_edge_length) for min, max in bbox)].astype(float) this distribution is fine if you want to mesh in the WGS84 projection. Same as for regular gaussian grids, the longitude rows need to decrease towards the poles. I compared here the density of longitudes along the latitude for the following ECMWF's Reduced Gaussian grids:
In the same function (source), we define:
to trim out extra points points depending on the mesh size. def _edge_length_wgs84(lat):
lrad = np.radians(lat)
return 1 / np.cos(lrad) ** (1 / 2) but instead of changing the whole equation of |
The sensitivity test on the polar circle are spot on now: |
@tomsail That makes sense, lon spacing definitely should be adjusted according to latitude irrespective of global mesh or not I reckon. If edge length is specified in degrees then we should assume it is meant degrees in latitude or "equator degrees". |
Good point. I could provide an example for Iceland, Greenland and see the differences with/without that correction. |
Hi @WPringle and @krober10nd, It's been a while, but I had some time to look at this. here are the results for area above Greenland. I don't think that using lon/lat projection is the best method to do this. I have documented this in a notebook where I tested 3 different methods:
I think method 2 is the safest method, because no assumption is made under the radar of the user. A feature to transform DEMs from WGS84 to any other projection would be nice but then again, it can be done separately too. |
In conclusion:
|
This issue is related to what was mentioned in the PR for global meshes about the stereographic distortion.
Close to the poles, the triangles get distorted and don't have the right equilateralness.
As mentioned,
To solve this issue, I have implemented a parametric law in the
mesh_generator()
:and illustrated it in the following python notebook
I will propose a PR with this parametric law. But I am still not convinced this is the best way to go..
The meshes look almost perfect closer to the poles now:
Keen to get another opinion on this.
The text was updated successfully, but these errors were encountered: