-
Notifications
You must be signed in to change notification settings - Fork 52
Add risk index outcome for navigation in ice-covered waters #968
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: develop
Are you sure you want to change the base?
Add risk index outcome for navigation in ice-covered waters #968
Conversation
Plots need to be refined (mostly labels and titles). Probably some commits will need to be squashed before merging. |
From Milena: @xylar, I helped Gennaro with this one. Hopefully, everything should be almost ready to go, but please let us know if you see anything amiss. Thanks. We'll post an example plot as soon as I can find it (we are in Italy right now, so same time zone as you). |
Here is an example output for this task: @proteanplanet: it would also be great if you could take a look and comment here. It would be nice if we could get rid of the rio>30 noisy results (darkest blue), but the things the we tried didn't work. |
@xylar, @proteanplanet, @stephenprice: in case you missed this since it came from a different username, I am pinging you again. No rush, just making sure you see it. |
I would like to suggest that rather than putting this into MPAS-Analysis, or perhaps in addition to putting this into MPAS-Analysis, we create an analysis member directly in MPAS-SeaIce that outputs the risk index. |
@milenaveneziani, I'll be back from vacation on Tuesday and will take a look as soon as I can after that. |
sounds good. Thanks @xylar. |
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.
@torotorotaxi and @milenaveneziani, this looks promising!
I have a few suggested changes, most minor. The only more significant one would be to move the hard-coded arrays to a data file.
It would be nice if we could get rid of the rio>30 noisy results (darkest blue), but the things the we tried didn't work.
I think the problem is that things are either fractionally above or fractionally below 30.0, depending on machine roundoff. I would move the upper bound to either 30.01 or 29.99 so 30.0 is consistently on one side or the other.
# this are labels that should appear in the plot, to indicate the Polar Class of the vessel (included here for the moment) | ||
# pic = ["PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "IA Super",\ | ||
# "IA", "IB", "IC", "Not Ice Strengthened"] | ||
|
||
# reference floe thicknesses for calculation of Risk Index Values | ||
# (this values were agreed upon by Elizabeth Hunke, Andrew Roberts, | ||
# and Gennaro D'Angelo based on literature and IMO description) | ||
h_riv = np.array([0.5, 10, 15, 30, 50, 70, 100, 120, 170, 200, 250]) * 0.01 | ||
# table of Risk Index Values (defined by IMO) | ||
riv = np.array([[ 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1 ],\ | ||
[ 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 0 ],\ | ||
[ 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 0,-1 ],\ | ||
[ 3, 3, 3, 3, 2, 2, 2, 2, 1, 0,-1,-2 ],\ | ||
[ 3, 3, 3, 3, 2, 2, 1, 1, 0,-1,-2,-2 ],\ | ||
[ 3, 2, 2, 2, 2, 1, 1, 0,-1,-2,-3,-3 ],\ | ||
[ 3, 2, 2, 2, 1, 1, 0,-1,-2,-3,-3,-3 ],\ | ||
[ 3, 2, 2, 2, 2, 1, 0,-1,-2,-3,-4,-4 ],\ | ||
[ 3, 2, 2, 2, 1, 0,-1,-2,-3,-4,-5,-5 ],\ | ||
[ 3, 2, 2, 1, 0,-1,-2,-3,-4,-5,-6,-6 ],\ | ||
[ 3, 2, 1, 0,-1,-2,-3,-4,-5,-6,-7,-8 ],\ | ||
[ 3, 1, 0,-1,-2,-3,-4,-5,-6,-7,-8,-8 ]]) | ||
|
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.
I'm pretty opposed to having arrays like this in the code, so it would be better to have all of this in a NetCDF or csv data file (with a date stamp). The file would also ideally be on the LCRC server and not part of the code. This would also allow us to update the data file with a new date stamp as needed.
# sea-ice concentration conversion from range [0,1] to range [0,10] | ||
scale_factor = 10 | ||
# polar class array index should be in the range [0,11], but not checked! | ||
pc = self.config.getint(self.taskName, 'polarClass') - 1 |
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 there a reason not to produce plots for all 12 classes? If yes, could there be a desire to produce plots for more than one class, in which case polarClass
should become a list of polarClasses
?
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.
@xylar: should we put this file in a folder inside observations/SeaIce? If so, I need to figure out how to call it (will look at another task for reference) and remind myself how I update the documentation so that it's reflected in https://mpas-dev.github.io/MPAS-Analysis/develop/users_guide/observations.html#sea-ice-observations.
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.
@milenaveneziani, please add information about your observations to the bottom of the sea-ice section of this XML file:
https://github.com/MPAS-Dev/MPAS-Analysis/blob/develop/mpas_analysis/obs/observational_datasets.xml#L1700
(before the icebergs section). You should be able to see what is expected from the other observations there.
Yes, please put your observations on LCRC under /lcrc/group/e3sm/public_html/diagnostics/observations/SeaIce
in an appropriate subdirectory and, if it helps you with testing, you can make another copy under /lcrc/group/e3sm/diagnostics/observations/SeaIce
. (Diagnostics get synced from public_html
to that location as well as to other supported machines as part of E3SM-Unified testing and deployment.)
mpas_analysis/default.cfg
Outdated
# Polar Class of vessel according to IMO. Range is 1 to 12 (increments of 1). | ||
polarClass = 6 |
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.
This should be documented a bit more to list the 12 polar classes, as is done in the code.
mpas_analysis/default.cfg
Outdated
# reference lat/lon for sea ice plots in the northern hemisphere | ||
minimumLatitude = -50 | ||
referenceLongitude = 180 |
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 seems like the comment need to be updated, since you have a minimum, rather than a reference, latitude.
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.
Also, this is for the southern hemisphere.
mpas_analysis/default.cfg
Outdated
# Polar Class of vessel according to IMO. Range is 1 to 12 (increments of 1). | ||
polarClass = 6 |
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.
This should be documented a bit more to list the 12 polar classes, as is done in the code.
mpas_analysis/default.cfg
Outdated
# reference lat/lon for sea ice plots in the northern hemisphere | ||
minimumLatitude = 50 | ||
referenceLongitude = 0 |
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 seems like the comment need to be updated, since you have a minimum, rather than a reference, latitude.
@milenaveneziani and @torotorotaxi, what would it take to get this finished and merge? it's been stale for about a year an a half so it's time to either push it through or let it go, I would say. |
My two cents worth - calculating the RIO as an MPAS-SeaIce analysis member has been on our list, and would provide a more accurate assessment of risk because it would access the sea ice thickness distribution in run time. I suggest dropping this PR and together pursuing the RIO output directly from MPAS-SeaIce instead. |
@xylar, @proteanplanet: we actually need this for two projects with @stephenprice, so please do not close it. @torotorotaxi and I will discuss the best way forward for this PR shortly. Thanks. |
@xylar -- Would it be possible for us to keep this PR open for a bit longer? We have an internal (LANL) project ongoing right now (winter-spring '25) that is working with/on this. Our assumption is that it will be in a position to merge following a bit more work during this time period. Thanks. |
@stephenprice, I'm fine to leave this up. I was just checking a couple weeks back because it seemed abandoned. |
c0c90e7
to
792484e
Compare
I rebased and addressed a few minor comments about documentation in the config file. We are testing this now on chicoma |
@xylar: for some reason Gennaro is unable to push to his own fork (permission issue..), which is weird, but in any case these are all his changes, which can be summarized as follows:
Things that for sure are left to do for this PR are: 1) add the RIV file to the public repo; 2) add something in the documentation that describes the RIV file. |
One last thing that we need to decide with @stephenprice is whether we want to add something related to a specific route. I feel like there are two ways of doing it: 1) use the remapped RIO climatology that is calculated here and save the RIO-on-route information to file. This would require a simple addition to this PR; or 2) do it separately as a separate script using MPAS native fields (similarly to how I handle transect time series or vertical sections along a transect). |
@xylar: an update on this. We have decided against adding anything else related to specific routes, so this PR should be almost ready to go (after resolving the conflicts). The only things left are these:
Could you please remind me how to do the documentation update? (I will also take a look at the documentation for developers) |
Here's the gist: |
For the RIV (which count as "obs", I think), I would appreciate an entry in https://github.com/MPAS-Dev/MPAS-Analysis/blob/develop/mpas_analysis/obs/observational_datasets.xml. Let me know if you don't think that's appropriate. |
yes, that was my idea as well (to count them as obs) |
@xylar: I followed the steps for adding documentation (plus I also added two list entries to
|
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.
@xylar: I followed the steps for adding documentation
Sounds good!
(plus I also added two list entries to docs/users_guide/analysis_tasks.rst, which was not mentioned in the developers documentation)
Sorry about that!
but I don't think I can see the tasks listed in my test build of the docs.
I build the docs locally and see the tasks fine. Maybe something went wrong in your build?
You'll probably know why right away..
I only see a few very minor issues, which I flagged below.
I also added these files to the public repo:
-rw-r-xr-- 1 ac.milena E3SM 633 Mar 31 17:13 obs.bib*
-rw-r-xr-- 1 ac.milena E3SM 874 Mar 31 17:16 README.md*
Could you chmod those two files to be group writable but not group executable? Not a big thing but presumably the intention.
climatologyMapRiskIndexOutcomeNH | ||
======================================= |
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.
climatologyMapRiskIndexOutcomeNH | |
======================================= | |
climatologyMapRiskIndexOutcomeNH | |
================================ |
climatologyMapRiskIndexOutcomeSH | ||
======================================= |
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.
climatologyMapRiskIndexOutcomeSH | |
======================================= | |
climatologyMapRiskIndexOutcomeSH | |
================================ |
Example Result | ||
-------------- |
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.
Example Result | |
-------------- | |
Observations | |
------------ | |
:ref:`imo_riv` | |
Example Result | |
-------------- |
Example Result | ||
-------------- |
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.
Example Result | |
-------------- | |
Observations | |
------------ | |
:ref:`imo_riv` | |
Example Result | |
-------------- |
it's possible. I'm glad you can see them just fine.
yep, done.
I also just fixed these. Not sure why there are conflicts in |
I think I have rebased successfully my local branch to origin/develop and solved the conflicts. I haven't pushed yet though, in case you prefer to handle things differently to preserve the commit history. Let me know what you think. |
A rebase is my preferred way so go ahead. |
8b56fcb
to
5295bbb
Compare
This is ready to go on my side, @xylar. Let me know if there is anything else that should be done. |
@milenaveneziani, I'm going to run my test suite and make sure I don't see any bugs. One more question for you all. My reading is that this would be on by default and doesn't require any special analysis member or anything like that to be present in the simulation. I just want to make sure that we do want the new analysis on my default without users having to set any config options. (It wouldn't make it into the Unified release that might happen today or tomorrow, it's just too late for that, so it would start showing up in E3SM simulation results in 6 months or so.) |
Here's what I'm seeing in the latest build of the docs. Looks good to me: |
exactly. This only needs default sea ice output to run. No problem about making it to e3sm-unified. We have our developer mpas conda builds that we can use for analysis. And yes, the documentation also looks good. |
I didn't think to sync the diagnostics fields before I ran my test suite, and my tests failed because the file is missing. It seems like others may run into a similar problem. Let me figure out why that's crashing MPAS-Analysis and not just causing the analysis task to fail. |
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.
@milenaveneziani and @torotorotaxi, I'm afraid I'm going to have to ask for some restructuring. It won't work to read the CSV file like you're doing in the constructor. The danger that this makes MPAS-Analysis as a whole unusable is just too high.
As an example, you can see how the Antarctic melt observations are read from a CSV file in run_task()
:
https://github.com/MPAS-Dev/MPAS-Analysis/blob/develop/mpas_analysis/ocean/climatology_map_antarctic_melt.py#L631
polarclass = np.int_(polarclass) - 1 | ||
|
||
# read in table of Risk Index Values | ||
#riv_csv = 'riv_MSC.1_Circ.1519_6_June_2016.csv' |
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.
Just a bit of suggested clean-up:
#riv_csv = 'riv_MSC.1_Circ.1519_6_June_2016.csv' |
IceClassLabels = np.genfromtxt(riv_csv, delimiter=',', skip_header=1, | ||
dtype=str, usecols=(0,)) |
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.
The problem here is that if riv_csv
is missing, MPAS-Analysis will crash completely. That's not a good state to be in. This file needs to be read and used in a run_task()
method, not in a constructor. As this is currently written, even if someone tries to disable this analysis, they are required to have this CSV file in order to run other analysis.
I can help with these changes if you need me to, but I'd be grateful if you could give it the first go. |
hmm, not sure if I have the bandwidth to try this, definitely not this week. |
That is what will happen if the file is missing anyway and what will crash all of MPAS-Analysis. The problem is that opening a diagnostics file that may or may not exist is simply not a safe thing to do in the constructor of an analysis task. You could have a |
@milenaveneziani, I looked into it a bit more and there isn't a clean way to reorganize in the way I was hoping (so the file only gets read when the task gets run) but it's easy enough to just do nothing if the file is missing. I have some suggested clean up and a fix on my branch here: Here's the clean-up I'd recommend: If you're happy with both, please cherry-pick them (or hard-reset to my branch and force push). |
# colormap for model/observations | ||
colormapNameResult = RdYlBu | ||
# whether the colormap is indexed or continuous | ||
colormapTypeResult = indexed | ||
# color indices into colormapName for filled contours | ||
colormapIndicesResult = [0, 56, 85, 170, 198, 227, 241, 248, 255, 255] | ||
# colormap levels/values for contour boundaries | ||
colorbarLevelsResult = numpy.linspace(-10., 30., 9) |
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.
You also need to define a colormap for the differences for main vs. control runs. (for NH and SH).
Here's an alternative approach I would recommend, in which the CSV file is stored in the python package instead of the diagnostics data. I realize I said above that the file would ideally be on the LCRC server. It seems like that approach isn't working out very well and that it needs to be in code to avoid issues when the data isn't found. |
I tested the alternative approach above. I had to make a small bug fix so I've updated the commit hash in the link. The results of my test suite with this approach look good: |
Sounds great! Will try to do this later this afternoon. |
I think it would avoid confusing if we remove the LCRC RIV directory, yes. And, yes, please update the docs. |
This adds a new analysis task to compute the risk index outcome (rio) from sea-ice concentration and (floe) thickness, as outlined in the International Maritime Organization (IMO) document (https://www.imorules.com/GUID-2C1D86CB-5D58-490F-B4D4-46C057E1D102.html).