-
Notifications
You must be signed in to change notification settings - Fork 51
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 example of regional configuration using regional-mom6 package forced with ACCESS-OM2-01 #338
base: main
Are you sure you want to change the base?
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
We need to ensure the example runs. Also we need to modify so that it uses the cosima-cookbook to load ACCESS-OM2 data; see COSIMA/regional-mom6#131 |
@ashjbarnes I tried to run this and it errors on initial condition. See the output of |
@ashjbarnes is this error related to the bug in COSIMA/regional-mom6#170? If so, it means that https://github.com/COSIMA/regional-mom6/releases/tag/v0.5.1 would be required. cc @luweiyang |
I tried to see if regional-mom6 v0.5.2 healed the issues I was having. It didn't... :( |
@ashjbarnes I tried to run the ACCESS-OM2 forced case and realised that the west and east unprocessed boundary files |
I've fixed the west and east boundary condition issues. I changed cell 6 in step 2 (changes in bold): The notebook is running fine now and I've pushed the working version to the However, I couldn't run the experiment as I keep getting warning & error messages about initialization and extreme surface state. So somehow the date of ocean forcing and atmospheric forcing do not match? Since we use repeated year forcing, I didn't think that would be a problem... Any thoughts? And it turns out that the temperature unit is K (instead of C) in
|
Great! something else we’d want to do is to use the cookbook to load the ACCESS-OM2 output |
@@ -0,0 +1,699 @@ | |||
{ |
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.
why there are 3 commented out lines of code @luweiyang?
if we need them, then uncomment,
if we don't need them then delete?
Reply via ReviewNB
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 don't think we need them. L20 and L21 are the same as L6 and L7 for selecting data along the dims yu_ocean
and yt_ocean
. I will delete them.
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.
Generally, commented code is bad practice...
Either we want the code or we delete it.
It's good to let go. :)
@@ -0,0 +1,699 @@ | |||
{ |
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.
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.
No, I commented them out when I was debugging because at some stage I did get some client-related errors. But it's no longer an issue. I will uncomment them.
this is related to loading from cookbook: COSIMA/regional-mom6#131 |
Yes, I checked the date as well and was confused. As @angus-g pointed out, the data in this folder The info for the atmospheric forcing is provided in Does this mismatch in year explain the initialisation error? |
Yes good find! It'll be crashing because of the temperatures being in Kelvin. This is strange - these lines of code check the minimum surface temperature value of the dataset and then assume that it's in Kelvin if this minimum is above 100. This used to work but apparently not any more! The code here hasn't been changed for a long time This notebook worked fine a while ago but it was neglected whilst we made a lot of changes. Somewhere we've introduced a change that breaks it but I don't know where.. |
This is good. It will force us to find whe K->C doesn’t work and implement a test to capture future similar failures. Let’s not ruminate on the past. Sure it worked at some point. It doesn’t matter that much, unless it helps us find why it’s not working now. Let’s just make an example that works now. It doesn’t even have to resemble how it was in the past if we want to showcase something else. |
If we are gonna load the RYF then there is no point referring to “year 2003” or anything. All years are the same! They are looped. I do think it more intuitive if we force with IAF, some particular year that we load via the cookbook |
Knowing that it worked in the past should help us troubleshoot though right? Nothing about the forcing dataset has changed, only our code. If our code used to correctly convert K to C and no longer does, that means something in the package (specifically something in the initial condition method) has changed that prevents it from doing this. I've had a quick look in case there was a premature "fill nans with 0s" or something but that doesn't seem to be the case |
Yes, same ocean forcing year and same atmos forcing did work in the past. I remember a while ago @ashjbarnes updated and recompiled MOM6, and with new exe file everything worked fine. |
I never doubted that it worked in the past.. But now it's not, so let's fix it. There are seem to be at least 1 or more issues. One is that temperature is not converted to K->C despite there is a method that supposedly does that. Possibly:
How does ERA5-forced example work? Is ERA5 in degrees C to begin with? |
This statement is unclear to me. I don't get what you want to say here @ashjbarnes. |
I've updated the notebook (uncomment client cell and delete the commented lines). I noticed that temperature in the unit of K in unprocessed initial and boundary conditions ( It would be nice to make this version work (for output1077 and RYF) and then try to read a particular year of forcing using cookbook. |
Thanks @luweiyang. OK, agreed, let's fix everything else and we convert to reading output via cookbook later. What's the plan for finding out where the K->C conversion fail? |
@navidcy @ashjbarnes |
longitude_slicer just slices the fields in longitude. It would be very counterintuitive if it was expected to call initial_condition. @luweiyang are you suggesting that the notebook never ends up calling the jnitial_condition method? |
No sorry, |
Sorry to clarify: The line that tries to convert K to C checks whether the minimum is greater than 100. This means that if NaNs have been filled in with zeros before this step then the check would pass regardless of the data being C or K. I read through the code and didn't see that this was the case. To debug we could print what the minimum of the temperature field actually returns, or copy the code into a notebook and return the temperature field at this step to see what it looks like. Or, instead of fixing it, a quick fix could be to add a "units" flag for temperature to both IC and BC functions so the user just has to tell us when it needs to do the conversion rather than trying to do so automatically. |
Hi both, it's helpful to discuss and read the code but we are not compilers and often just by "reading the code" we (or at least I) fail to capture what is actually going on. So to be certain of what's happening here we need to properly debug. To do that we should modify the regional-mom6 source code and install the local copy of the regional-mom6 in the environment so that the notebook uses that. Only this way we (or at least I) would be able to pin-point the source of the matter and fix it. Thoughts?
I suggest we "properly fix it" rather than doing a "quick fix". There must be some error in the logic and it's good to make this robust. Note that in addition, my personal experience suggests that a proper fix ends up saving everyone (developers and usrers) much more time compared to what a quick fix does. |
I did a quick test and the if condition for checking the min temperature was not satisfied. I used an old environment ( I added a line |
Can you post here what you did? A minimal example of a notebook loading the temperature and trying to reproduce what the package does demonstrating that it fails? |
You can always install a local copy of the package even if it’s already installed in the environment. You just need to ensure that you are using your local copy and not the version in the env. I’ll try to demonstrate that and post the code here |
Could this be the culprit? >>> import numpy as np
>>> temp_K = np.array([270., 272., 287.])
>>> temp_K
array([270., 272., 287.])
>>> np.min(temp_K)
270.0
>>> np.min(temp_K) > 100
True But if this was masked, then] >>> import numpy as np
>>> temp_K_masked = np.array([270., float('nan'), 287.])
>>> temp_K_masked
array([270., nan, 287.])
>>> np.min(temp_K_masked)
nan
>>> np.min(temp_K_masked) > 100
False ? If it is, then the solution would be to use >>> np.nanmin(temp_K_masked)
270.0
>>> np.nanmin(temp_K_masked) > 100
True |
Nice that could be it!! |
@luweiyang could you check that with the change suggested in COSIMA/regional-mom6#176 the issue goes away? |
This closes COSIMA/regional-mom6#59
cc @ashjbarnes