-
Notifications
You must be signed in to change notification settings - Fork 25
Create southern boundary features for each MOC basin #78
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
Conversation
This merge adds a script, subdivide_transects.py, that is used to subivide transects (LineStrings) longer than a maximum length (in degrees) into an integer number of subsegments. This is useful because some tools (e.g. the MPAS MaskCreator) don't necessarily follow the desired path between points that are far apart.
|
This PR is a replacement for #75, where the approach I used didn't work out. |
|
@milenaveneziani, I implemented the features I described here: #75 (comment) I was able to create the masks with the mask creator using: mesh points to the |
|
@milenaveneziani, the results described above look reasonable to me. If we don't yet have a way to test them as part of an MOC calculation, it might be best to go ahead and merge this PR, and we can always make corrections in the future. Let me know what you think of this approach overall and if I can clarify what I've done. |
With this merge, setup_ocean_basins first removes small polygons from MOC basins that are not useful for MOC computations. Then, it finds the southern boundary of each MOC basin. Finally, the southern boundaries are subdivided into 0.1 degree segements to ensure that the MPAS mask creator follows them with high fidelity.
49c1d00 to
9dca6bd
Compare
|
I just pushed some changes to make the code PEP8 compliant (at least those aspects that |
|
@xylar: thanks! This makes sense to me. |
|
@xylar, a side note: I made the mask file using the 60to30 mesh, but when I ran the paraview extractor using your command logic above, I get the following error: which in a sense takes me back to the issue of what exactly we want/need to have in a mesh file in order for our tools/analysis to work always. Anyway, @DieMuhkuh, @mark-petersen : I now have the mask files (basins and transects) for the 60to30 mesh. Do you think you can test the MOC AM with these when IC comes back up? |
|
@milenaveneziani, I think you are probably working with an out-of-date version of the paraview extractor. This issue has been fixed.
You don't really have a choice about what's in the mesh file. It's a file that defines the MPAS mesh, so has nothing specific to MPAS-O in it. It comes from the mesh database as part of setting up a testcase. The mesh file is not the same thing as an output file, though the output file may contain all the information form the mesh by adding the the mesh to its stream definition. The discussion is that the mesh information is rather large and doesn't need to be in every output file, since we always know that its contents are in the mesh file (usually |
|
hmm, I was using the version that @pwolfram was working on for facilitating the building of MPAS-Tools on different platforms (because I was using edison, and therefore referred to the comments in MPAS-Dev/MPAS-Tools#136). |
|
@milenaveneziani, I see. That branch is a good choice for the mask creator, etc. but not for the paraview extractor. But it does indicate that we should push to have MPAS-Dev/MPAS-Tools#136 merged sooner rather than later so both can be found in the same branch. |
|
@xylar, @DieMuhkuh: @vanroekel used the MOCSouthernBoundary mask file that I created from the geojson file of this PR and the 60to30 mesh, to compute offline MOC (from a script that @mark-petersen provided). He finds weird results (Atlantic MOC has a weird structure, with very small positive values in the top 1500 m and large negative values underneath). He then used the same MOCbasin mask, but a transect that Mark used in the past, and the results look much more reasonable. So the problem seems to be the southern boundary mask (MOCBasin mask is fine). |
|
@milenaveneziani, @mark-petersen and @DieMuhkuh, sorry this isn't working as you need it to. It could be that I haven't understood correctly what the requirements of the southern boundary feature, in which case it would be good to have this clarified as part of an issue or a confluence page. It could also be that My understanding is that what is needed is a transect that includes all edges on the MPAS grid that make up the southern boundary of each MOC region. Again, if I have understood correctly, this transect would include all edges with one neighboring cell in the MOC region and one cell out of it. Presumably for convenience, the transect could also include edges of cells along the southern boundary that border land but I'm not sure if that's a requirement. To help you work on this, I would need a better sense of what @mark-petersen's southern boundary transects look like and how these differ from what I provided. While I understand that the resulting MOC was not satisfactory, this information isn't very helpful to me in determining what the southern boundary feature should look like to fix the problem. In short, I would not like to continue to operate in a way where I produce a feature, wait several days, and find out that that's not what you were after, can I try again? |
|
@xylar, @mark-petersen, @DieMuhkuh: would it help if we visualized the MOC southern boundary feature that resulted from this PR and also the corresponding mask file? I meant to do this yesterday, but didn't make. |
|
@milenaveneziani, ideally we would visualize the MOC boundaries produced by @mark-petersen's script and the one produced by this PR so I could understand better how they differ. It would also be very helpful to understand how the MOC southern boundary produced by @mark-petersen's script corresponds to the MOC basin feature (i.e. is it exactly the edges that make up the southern boundary as I described above; are those edges complete or are there gaps where the southern boundary intersects land?). Whatever you can do to help clarify what is needed would be helpful to me. |
|
ok, so this is the MOC southern boundary feature: The problem may be in the Australia and Papa New Guinea regions. |
|
@milenaveneziani, could we try to get a more specific requirement? Would it be sufficient if we had a single line that went straight from each westernmost point to each easternmost point without following the land boundary? |
|
I think that that should be sufficient, but again @mark-petersen and @DieMuhkuh should confirm this. |
|
I spoke with @milenaveneziani on the phone and we agreed that the Atlantic MOC should have worked if it were sufficient to have a transect that's a single straight line for each MOC basin, whereas it didn't work. This suggests that maybe the southern boundary can't be found in |
|
@xylar As far as I'm concerned, the transect would be fine as long as each edge only appears once and with the correct sign. Since we only consider the transport through each facet below a transect edge, it should not make a difference if the transect goes around land, since the water transport through land should be zero. |
|
Thanks, @DieMuhkuh. @milenaveneziani and @DieMuhkuh (and maybe @mark-petersen), can you look into why the southern boundary for the Atlantic MOC basin didn't work? That one should have no land (or weird double-counting of edges) involved and yet it sounds like it didn't work. Is that because the mask creator just got the wrong edges? |
|
@xylar: I may have a hint of why the Atlantic MOC boundary didn't work, but I have to verify it. I can try tomorrow (sunday), although I may have to postpone to Tue (Mon is already full for other reasons). So, let us put this on hold for a couple of days. thanks for the huge help so far. |
|
@xylar and all: I did not have much luck with finding out what the problem may be with the Atlantic_MOC southern boundary generated here. Here are some plots though, to see if other people (especially @DieMuhkuh and @mark-petersen) can make an informed guess. And this is the southern boundary used by Mark for previous MOC (offline) computations: |
|
@milenaveneziani, it sounds like maybe the behavior of the mask creator with a LineString made up of multiple segments isn't going to work. With a single line segment, the mask creator finds a path from the closest edge to the first point to the closest edge to the last point, never reusing an edge, which is the desired behavior. The undesired behavior is that it does so in a zig-zag pattern, as above. @milenaveneziani, @mark-petersen and @DieMuhkuh, am I right in thinking this mean we need to fix the mask creator (MPAS-Dev/MPAS-Tools#143) and that if we did so, a simple segment (with no subdivision) across the bottom of each MOC basin would be the desired geometric feature? |
|
@xylar: may I venture a question? Since we have the MOCBasin mask already, could we simply pick the cells that make up the southern border of that? We could then be sure that that southern boundary is really the southern boundary corresponding to that particular MOCBasin mask, as it should be. |
|
@milenaveneziani In my opinion, this would be the most correct solution to this problem. The problem I see with that is, that the mask creator would have to know which regions are MOC regions so that it knows when a southern boundary has to be calculated. |
|
@DieMuhkuh: we do have the regionGroup in the features. The mask creator could be instructed by that. |
|
@milenaveneziani and @DieMuhkuh, I think this requirement is too specialized to try to build it into the mask creator. However, it would probably be quite easy to build a specialized python tool to extract the southern boundary of the MOC regions from the NetCDF file (assuming we could give a satisfactory definition of what is meant by the southern boundary). The python tool could create the same transect fields that the mask creator would make, so the workflow would be essentially unchanged once the tool was run. Why don't I try to give this a go, and we can see if the results are satisfactory? |
|
ah! that seems like a great option, @xylar. So we don't have to change the mask_creator at all. |
|
@milenaveneziani, I think I have a pretty good idea of what it needed. If the results of my tool aren't quite what's needed, at least we'll have something to tweak. But I'm pretty confident I can get you what you want. |
|
I am closing this PR but keeping the useful parts in #79. As discussed above, we will pursue alternative methods for finding the southern boundaries of MOC features. |





With this merge, setup_ocean_basins first removes small polygons
from MOC basins that are not useful for MOC computations. Then,
it finds the southern boundary of each MOC basin. Finally,
the southern boundaries are subdivided into 0.1 degree segments
to ensure that the MPAS mask creator follows them with high
fidelity.