-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add general CORDEX coordinate boundary fix #184
Add general CORDEX coordinate boundary fix #184
Conversation
This PR depends on #183. |
I reworked a bit this pull request, but I need a CORDEX dataset that actually requires this fix to test @aperezpredictia , @mwjury can you provide an example? |
Hello, you can just try with this dataset: https://cloud.predictia.es/index.php/s/E6IqhWhhy5ghlMi |
Ready to test from my side To simplify the management of CORDEX, I modified a bit the way we load the fixes to allow define generic project fixes that will be applied to all datasets. The CORDEX fix is implemented in that way |
Thanks @jvegasbsc and @aperezpredictia, works like a charm! I tested it also for extract_region (works fine) and area_statistics (doesn't, see #631). |
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.
Great to see progress here! Just a small comment, could you have a look?
@mattiarighi Could you please run a final test and merge? |
The thing that is special about CORDEX is that basically all coordinate systems are rotated lat-lon systems. Taking this into account would be better than using the rather crude interpolation to which we are condemned in situations like the bcc grid. |
Where and how should this be taken into account? Would that affect this pull request? |
Yes, this would affect this pull request. This PR calculates boundaries for 2d lat-lon coordinates in a generic way, that is it interpolates a spline to put cell corners roughly between cell centers in 2d space. This approach is appropriate where the cell center coordinates have no simple relation, or that relation is not correctly available as in the case of the bcc-csm models where it allows us to still get somewhat meaningfull cells. However, here we have a simple rotated grid where not only 1d rotated coordinates |
Thanks for explaining @zklaus! @jvegasbsc Could you please have a look?
I have been working a bit on this and the procedure suggested by @zklaus. I ran into some problem as some of the models are having wrongly defined, and/or iris is making trouble when reading lamber conformal conical coordinate systems. I tested it on virtually all CORDEX EUR-44 models. @zklaus, @jvegasbsc could you have a look please. |
@zklaus @jvegasbsc Made some updates and had to fix an error due some proj.db error I had. which is now also tested for CORDEX EUR-11 models. |
What is the status of this PR? Is there any way I can help you? |
Sorry @mwjury for the lack of response. A couple of questions:
The e-06 we can ignore safely, I think. Looks like float issues to me About the 0.005 one, which is the resolution of the dataset? For 45º lat, using 45.005º is wrong by ~500m, so it will be only significant for HR experiments. In any case, it is a model issue |
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.
It would be nice to also have some unit tests for this, as the code looks pretty complicated, so without unit tests this will become very difficult to maintain/update.
@jvegasbsc We now also have pre-commit hooks, you can start using them by running |
Sorry just returned from my parental leave. Thanks for pushing that forward @jvegasbsc . Let me know if I can help. |
I will prepare something, but it will be a regression test, as I do not have the knowledge to do proper unit testing on this |
Hi, are there any news about this PR? What is the current status of using CORDEX project in ESMValTool? |
As mentioned in #772 this PR needs merging in order for regridding with many CORDEX models to work. It is also very handy because it also resolves some issues related to some of the CORDEX models that have LambertConformal projections. Another potential issue mentioned in #772 by @zklaus and also at #184 (comment) is that of the minor rounding / machine precision size differences that exist on CORDEX grids. I'm not sure if there are two possible issues here though?
My understanding is that this PR warns about number 2, but number 1 is still a potential issue. It might be possible to fix both by rounding all coordinate data to a set precision level, or perhaps there could be another solution involving pre defined standard grids for each domain stored somewhere, it might take some time to come to an agreement on the best solution to this. My feeling is that perhaps we try and get this PR merged (it seems the blocker at the moment is some comprehensive tests for these fixes). And then deal with solving the minor differences in coordinates in a seperate issue / PR. Essentially this PR resolves an outstanding issue that will unlock progress in other areas (i.e. regridding). The coordinates precision issue should probably be addressed, but isn't a hold up to the essence of this PR, so maybe that should become a seperate issue? |
… CORDEX_add_fixes
Codecov Report
@@ Coverage Diff @@
## main #184 +/- ##
==========================================
- Coverage 88.04% 87.06% -0.99%
==========================================
Files 194 195 +1
Lines 9765 9897 +132
==========================================
+ Hits 8598 8617 +19
- Misses 1167 1280 +113
Continue to review full report at Codecov.
|
Just to bump this PR, I've started doing some work with CORDEX data from the CAM-44 domain and needed this PR in order to do regridding and area averaging of the data. (As was also the case with models from the EUR-11 domain) |
@thomascrocker Unfortunately @jvegreg who was previously working on this has left the project, so is unable to finish this. To get this merged or make the functionality available in some other way, we first need to agree on what the correct implementation is. Unfortunately, I personally do not have the required knowledge to say anything meaningful about that. @zklaus Would you be able to comment on this? @ESMValGroup/tech-reviewers or @ESMValGroup/science-reviewers Can anyone who is knowledgeable on CORDEX data please have a look at this and comment? If there is agreement that the approach here is viable, then the way towards getting this merged would be someone having a look at the checklist in the top post above and seeing what still needs to be done and following up by actually doing it. |
@bouweandela |
hi all, can someone who was involved in the review of this work please confirm what the status is and how we can move it forwards? This seems a real foundation issue for the use of CORDEX. I might be able to help with some of the coding and/or review. It would also be really useful to have a simple example in an issue of the problem this fix is trying to resolve. It would probably also help to make it more granular by starting only with rotated pole models and then building from there? |
Myself and @pepcos will be picking the CORDEX related issues up, but I have to say that we are going to need some context first, as we are a bit lost at the moment. |
I can probably help provide some context but I have as yet limited experience with using ESMValTool myself. (and no funded time to work on). @thomascrocker - do you think we could together write some failing recipies for e,g, a. single rotated pole model which has good metadata and open issues for each of these? |
@pepcos and I have some experience with ESMValTool, so it would be no problem to help. We do very much have an interest on this, but right now with the release in the middle is not the best time. We will start working on this after the release is done. |
Good idea, it shouldn't be too much work to do so. I will hopefully be able to get around to it sometime next week, |
OK, I spent much of Friday afternoon looking at this, and have created a simple recipe. Also.. there is a possibility of the work that sparked my interest in this issue being useful in another funded project so it might be I can justify a little more time on this... 🤞 Simple recipe below:
The first dataset listed The second dataset
If this PR is applied though, the recipe will run fine. The final dataset |
Just having a look at the details of this pr the lambert conformal fixes are in this line here:
I.e. dealing with some models that have the coord system badly defined. I suspect this would be better applied as model specific fixes (although maybe with this function stored in a shared module that can be called from each fix individually) rather than has a blanket fix for everything from a project. In any case it's probably better off as a separate issue / PR, and leaving this one to deal solely with the bounds issues. |
I think a good part of this work is now covered by #1765 . I guess this can be closed |
Description
CORDEX has not rlat / rlon / lat / lon boundaries, so we have to use the function already created for the bcc but guessing the boundaries of rlat / rlon in order to interpolate later them to lat / lon.
This PR is part of #182 , which is being separated into parts.
In the documentation, we should write something like '''Fixes for cordex-eur11-44''' instead of '''Fixes for bcc-csm1-1.'''
Closes #issue_number
Link to documentation:
Before you get started
Checklist
It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.
To help with the number pull requests: