-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix wrong reprojction to wrf domain #60
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Ok, as far as I can see this all works now:
@dargueso @theendlessriver13: perhaps you can review? If accepted, I guess we should bump the version number, and update pypi. |
@matthiasdemuzere, sure, I can check it out, but won't be able to do so before Monday. |
I realized there is another level of complication that we did not yet take care of. Geo_em files can be on different projections. This is information is stored in MAP_PROJ. for sample data:
for Italy data from pippo2013:
More info:
So far this new code caters for 1-Lambert only. So a check is needed within
We can probably get a long way borrowing some code from salem. I can only look into this later, no time at the moment ... |
@matthiasdemuzere, sorry, I probably wasn't clear enough in my last messages. I thought you were aware of that. When I discussed the issue (#56 (comment)), I had this multiple projection option in mind. You have to add the rotated-pole option to the above. I think we can indeed do most of the work with salem or wrf-python. WRF-python reads all possible wrf projections and makes it easy to reproject after. |
So far I developed a solution without additional packages. Could be good to keep it this way, as e.g. Let me add these other ones. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Ok, I now added the different type of projections. MAP_PROJ = 1 was tested with the Italy data. That looks fine, let's see if Pippo2013 can confirm this. MAP_PROJ = 6 was tested with input from Unfortunately, the projection does not seem to be correct yet. So this needs more work. So all of this still needs a bit of work ... |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I believe this is done now. I tested the reprojection implementation for MAP_PROJ 1, 2 and 6. All seems good. @theendlessriver13 do you want to review this one last time? If accepted, I guess we should bump the version number, and update pypi. |
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.
Looking very good, nice that this is done, thank you!
A few final questions:
- can you elaborate a little what has changed in the netcdf files - sample and testing data?
- Why are so many hard coded values in the tests changed, all due to the different projection and slightly moved pixels? What does this mean for data generated with the
0.2.0
version are they all slightly off? - Would you classify this patch as a "bug fix" or a "new feature" so should this become version
0.2.1
or0.3.0
?
for more information, see https://pre-commit.ci
The netcdf files in
The previous reprojection was slightly off, as I was treating the WRF grid as a regular grid, but it is not.
This patch fixes a bug in the reprojection from high-res LCZ to low-res WRF. |
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.
Addressing Issue #56
Issue: Reprojection from the high-res LCZ grid to the lower-res WRF grid resulted in errors for larger domains.
Reason: WRF has an irregular latlong grid, and this was not taken into account when reprojecting.
Solution: Inspired by the blog information provided by Fabien Maussion here, the procedure is not completely changed:
create_wrf_gridinfo()
routine that wrote a temporary .tif file, containing WRF's grid info, is now removed._get_wrf_grid_info()
is introduced to get a proper description of the WRF grid, in its native Lambert Conformal Conic projection.crs
andtransform
values needed to Reproject the lcz info to the wrf grid.