-
Notifications
You must be signed in to change notification settings - Fork 53
Add script to plot online MOC #415
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 script to plot online MOC #415
Conversation
| ['timeMonthly_avg_normalGMBolusVelocity', | ||
| 'timeMonthly_avg_vertGMBolusVelocityTop']) | ||
| if self.mocAnalysisMemberEnabled: | ||
| # I think the bolus velocity should always be included if GM is on |
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 think the following should be changed so that it's no longer an option. If GM is on, we need to include the bolus velocity part.
| config = self.config | ||
|
|
||
| #********************* | ||
| # Needs to be edited from here on |
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 following needs to be edited substantially, but we need to keep the option to read from an already computed climatology. I am still figuring out how I do that, hence no much change can be found below :|
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 can help here if you can describe more specifically what is needed.
| np.amax(latBins)+latBinSize, | ||
| latBinSize) | ||
| mocTop = self._compute_moc(latBins, nVertLevels, latCell, | ||
| regionCellMask, transportZ, velArea) |
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 following 3 lines is the bit to compute the MOC at 26.5. I need to put this into a region loop, keeping in mind that MOC online has two separate arrays: one for the Global bit and one for the regional bit. At the moment, the latter is for the Atlantic, if indRegion=0.
| # }}} | ||
|
|
||
| def _compute_moc_time_series_analysismember(self): # {{{ | ||
|
|
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 is mostly done, but we probably do not need to save the timeseries to file this time, since it's a super simple calculation once we have the online MOC.
Also, there are lots of repetitions with the _compute_time_series_postprocess function.
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.
Please do make sure to save the time series data. The main reason is that it makes it possible to use it as a reference data set when doing a main vs. ref comparison. In the not-too-distant future, we would want to do the same with the MOC lat vs. depth plots, too, so we will also need to store a copy of them.
| self.logger.info(' date: {:04d}-{:02d}'.format(date.year, | ||
| date.month)) | ||
|
|
||
| # hard-wire region=0 (Atlantic) for now |
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 whole region handling will change substantially once we use the regional capability fully.
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.
Yes, see #246
| depth = ncFile.createVariable('depth', 'f4', ('nz',)) | ||
| depth.description = 'depth' | ||
| depth.units = 'meters' | ||
| depth[:] = self.depth |
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 think I took care of most of the changes needed here.
Note the change on the line above depth[:] = self.depth, with respect to the _compute_moc_climo_postprocess respective line. I think we should change it in there too, but I'd like to double check with you first.
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 went ahead and made this change in _compute_moc_climo_postprocess as well.
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.
Yep, seems fine to me. We might want to think about how this would change for a non-z-level grid in the future but that's a separate issue and there's already a GitHub issue for it (#120)
|
I will do some testing now. |
|
This is not working. It hangs, I think at the climatology task, and no log file is even created. |
|
ok, the problem seems to be NERSC. It's having trouble accessing the scratch directory right now. Will try again when things are back to normal. |
|
ok, after fixing a few things, a test finally gives some reasonable results. And this a result I obtained previously using the postprocessing script and accounting for the bolus velocity: Aside from some plot differences (we need to plot better latitude extent), I suppose the differences between these two groups of plots are due to the fact that the online MOC is not accounting for the bolus. I need to test this by looking at a high-res run (no GM). |
|
@xylar: you will probably hate |
| latAtlantic = self.lat['Atlantic'] | ||
| dLat = latAtlantic - 26.5 | ||
| indlat26 = np.where(dLat == np.amin(np.abs(dLat))) | ||
| indlat26 = np.where(np.abs(dLat) == np.amin(np.abs(dLat))) |
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 believe this was a bug, and we were just lucky that it worked before.
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 agree.
|
One TBD thing is to add a temporary config option to force the use of the postprocessing script, even if the AM is on, until we fix the online MOC to take into account the GM bolus velocity, when GM is on. |
|
From the results, it looks like this is really coming along. |
|
Trying to find a high-res case for testing now. This should be ready to be reviewed @xylar. Any suggestion about how to adjust the latitude range in the plot is welcome. The latbin variable does not depend on the regionName in the MOC AM, it just goes from -90 to 90. |
|
@milenaveneziani I can test this on anvil, you could also test this on the coupled run on theta. /projects/ClimateEnergy_2/azamatm/E3SM_simulations/20180410.A_WCYCL1950_HR.ne120_oRRS18v3_ICG.theta/ |
|
ok, @vanroekel, thanks. |
|
@vanroekel or @xylar, could either of you transfer the transect file for the RRS18to6v3 on theta? I have completed the MOC online ON test for the coupled high-res run on theta, I only have to do the test for MOC online off. Thanks. |
|
@milenaveneziani, if you're not it the ccsm group on theta, I think you should get yourself added. I don't want to make /projects/ccsm/acme/diagnostics_data/region_masks world writable. You should definitely be using that directory rather than the one @vanroekel owns on theta. We should delete the other directory, since we don't plan to maintain it. |
|
I think I just downloaded what you needed (oRRS18to6v3_SingleRegionAtlanticWTransportTransects_masks.nc) from https://web.lcrc.anl.gov/public/e3sm/diagnostics/mpas_analysis/region_masks/ |
@milenaveneziani, I can't think of a better option than having a config option for this. My plan in #246 is to have a separate config section of each region (for now, |
|
@milenaveneziani, I'm having trouble maintaining a connection to Edison long enough to do a full test. But I did an MOC-only test here: Everything looks good to me! |
| ninoSubdirectory = Nino | ||
| mhtSubdirectory = MHT | ||
|
|
||
|
|
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 think we want to keep 2 blank lines between each section so it's easier to find section. @gstreletz did a lot of work to put in this formatting.
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.
Oops, sorry. I thought this was config.default. Ignore my comment above.
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 only removed it because it wasn't consistent in the config example cases: in most cases there weren't blank lines, so I thought of just removing this one.
Instead, config.defaults has the blank lines between each section.
| # in its calculation, whereas the postprocessing script does. | ||
| # NOTE: this is a temporary option that will be removed once the online | ||
| # MOC takes into account the bolus velocity when GM is on. | ||
| usePostprocessingScript = True |
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 think this is perfectly fine as a temporary solution.
|
Thanks for downloading the transect file. That is the right one. |
| depth.description = 'depth' | ||
| depth.units = 'meters' | ||
| depth[:] = refTopDepth | ||
| depth[:] = self.depth |
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.
Yep, fine to change this.
|
Oh, my goodness! MOC goes from one of the slowest tasks to one of the fastest for runs that can handle it! |
|
QU240wLI tests with both python 2 and python 3 ran successfully with the offline MOC (because the analysis member was not enabled). An EC60to30 test with python 3 ran just fine as well, with the analysis member (essentially same test I tried on Edison with python 2). An EC60to30wLI test is running now (with python 3 and offline MOC) but I don't think I need to wait for it to approve the PR. I'd suggest putting in the latitude bounds before merging but I don't think I need to approve the results since it's likely a simple fix. The code to crop the xarray data set should be something like this part of the SOSE transects: |
|
So, these are the results of my test on the coupled high-res case. Online MOC script ON: Online MOC script OFF: I would have preferred a better correspondence for the Atlantic MOC between the 2 cases, but I think this is good enough. At least there is nothing wrong with the script. Now the only thing to fix is the latitude range. And yes, now the MOC is the fastest task. |
Global looks great! Atlantic isn't that different and I suspect differenes are due to different masking. The online MOC doesn't use the mask from |
|
Yes, they use the same transect. I don't remember about the regional mask file. Maybe @vanroekel does. |
0057825 to
e918458
Compare
| 'latBinMax{}'.format(region)) | ||
| indLat = np.logical_and(x >= minLat, x <= maxLat) | ||
| x = x[indLat] | ||
| z = z[:, indLat] |
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 do not have xarray datasets at this point, so I am subsampling x and z individually.
|
The latitude bounds as config options work. I just added them to the @vanroekel: I think between me and @xylar there was enough testing for this one. I can remove you as reviewer and merge, if that is OK with you. |
|
I agree. Please feel free to remove me as a reviewer. Thanks for adding this!
Sent with BlackBerry Work
(www.blackberry.com)
From: Milena Veneziani <[email protected]<mailto:[email protected]>>
Date: Tuesday, Jun 05, 2018, 9:58 PM
To: MPAS-Dev/MPAS-Analysis <[email protected]<mailto:[email protected]>>
Cc: Van Roekel, Luke <[email protected]<mailto:[email protected]>>, Mention <[email protected]<mailto:[email protected]>>
Subject: Re: [MPAS-Dev/MPAS-Analysis] Add script to plot online MOC (#415)
The latitude bounds as config options work. I just added them to the streamfunctionMOC section for now.
@vanroekel<https://github.com/vanroekel>: I think between me and @xylar<https://github.com/xylar> there was enough testing for this one. I can remove you as reviewer and merge, if that is OK with you.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#415 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ANB5UTbnme-NsELYby-j820iG4Jizhzoks5t51NwgaJpZM4UXVj8>.
|
|
Thanks Luke. |
|
This was easier than expected, thanks to @vanroekel notebook script. |
|
Congratulations, @milenaveneziani. This seems to have gone quite smoothly. |
This is very 'work in progress' for now. I just wanted to open this for discussion of some points.