MPAS-Dev / MPAS

Repository for private MPAS development prior to the MPAS v6.0 release.
Other
4 stars 0 forks source link

Update regional stats calculations #1506

Closed stephenprice closed 6 years ago

stephenprice commented 6 years ago

This pull request updates the land ice regional stats analysis member so that it duplicates all of the current calculations available in global stats. Code was also rearranged to follow the same overall structure as the global stats subroutine (with exceptions related to looping over regions and blockSums requiring allocation / deallocation). The code was tested on the uniform 20 km Antarctic mesh and spot checking off all fields gave reasonable results. Some minor clean up was also done in the global stats analysis member code.

matthewhoffman commented 6 years ago

@stephenprice , if you wanted to add the GL flux stat to regional stats in this PR, you could copy the implementation I had for global stats in PR #1504 in this commit: https://github.com/MPAS-Dev/MPAS/pull/1504/commits/f0f08859471fecf0df0ef10d713fc16d6b0ba5d8

stephenprice commented 6 years ago

@matthewhoffman -- Ok. I should have thought of that already. That makes sense. Leave this alone then until I take a look at that and get back to you. Thanks.

stephenprice commented 6 years ago

@matthewhoffman -- one thing I realize is that when converting a global stat. to a regional stat., we always multiply by the field:

real(regionCellMasks(iRegion,iCell),RKIND)

This zeros out all values in the calculation that are also not in the current region of interest (which you are looping through). This suggests we would need an equiv.

real(regionEdgeMasks(iRegion,iEdges),RKIND)

field ... but there isn't one created by default (as far as I can tell) when generating the mask.nc file from the mask creation tool and a geojson features file. I think I might recall Doug noting this at some point in the past (only cell support exists for regions mask). I can check on this w/ some others working on MPAS-O analysis. But if that is the case, we may not be able to do this calc. on a regional basis just yet. I guess we could try to determine if the edge in question is associated with a cell that has a value of 1 in the regionCellMask field?

stephenprice commented 6 years ago

@matthewhoffman -- I implemented the check for whether or not an edge is associated with a region of interest using cellsOnEdge as you suggested. The code seems to run with this and produce reasonable results (based on spot checking a few GL flux estimates against Rignot values) ... so I'm going to update my branch and have you look at it when you get a chance. Thanks.

matthewhoffman commented 6 years ago

@stephenprice , we should squash the first 3 commits together because the first two don't build. I can do that if you want.