Use an internal bilinear interpolation instead of scipy for meshDensity and bathymetry#344
Merged
xylar merged 15 commits intoMPAS-Dev:masterfrom Sep 4, 2020
Merged
Use an internal bilinear interpolation instead of scipy for meshDensity and bathymetry#344xylar merged 15 commits intoMPAS-Dev:masterfrom
xylar merged 15 commits intoMPAS-Dev:masterfrom
Conversation
Move several tools that are specifically for the ocean to `mpas_tools.ocean`. Tools related to defining signed distance functions have been pulled out of `coastal_tools` and remain in `mpas_tools.mesh.creation`, since they should be generally useful. In the function lonlat2xyz, the radius has been added as an optional parameter, and the Earth radius is now a required parameter for signed distance functions.
Each function now takes as parameters the results of the function in define_base_mesh, rather than calling that function. This is a much cleaner way to pass in the fields and gives users a lot more flexibility. Since bathymetry and floodplain are ocean-specific concepts, the code for adding them has been moved to mpas_tools.ocean and isn't appropriate to include in build_spherical_mesh anymore. So calling code will need to add these steps after calling build_shperical_mesh.
Add a warning that build_mesh docs are now completely useless.
This particular meaning of meshDensity is a legacy of the pre-JIGSAW method for mesh generation and is only used in the ocean core.
This saves us from having to know the name of the output file in cases where we don't need to write out and read back the mesh density.
These add meshDensity and optionally add bathymetry and preserve floodplain
It is not very safe to use a non-integer step in arange because round-off causes trouble. Also, in this case you want to include the end point in the arange and this was not happening with the previous code.
Collaborator
Author
Collaborator
Author
TestingI tested this with the Interpolation is significantly faster with the new routine. I didn't time the difference but it is noticeable. |
Collaborator
Author
|
Implicitly approved by @mark-petersen and @sbrus89 via MPAS-Dev/MPAS-Model#680 |
This was referenced Sep 4, 2020
mark-petersen
added a commit
to MPAS-Dev/MPAS-Model
that referenced
this pull request
Sep 9, 2020
Update to version 0.1.11 of the compass environment #688 This brings in several changes from MPAS-Tools: * Changes to make sure the Earth radius is consistent throughout COMPASS and `mpas_tools.ocean` by using the CIME value (MPAS-Dev/MPAS-Tools#347 and MPAS-Dev/MPAS-Tools#341) * Improved performance for interpolation of meshDensity and bathymetry (MPAS-Dev/MPAS-Tools#344) * Reorganization of `mpas_tools.mesh.creation` (MPAS-Dev/MPAS-Tools#314)
xylar
pushed a commit
to xylar/old_compass2
that referenced
this pull request
Oct 12, 2020
Update to version 0.1.11 of the compass environment #688 This brings in several changes from MPAS-Tools: * Changes to make sure the Earth radius is consistent throughout COMPASS and `mpas_tools.ocean` by using the CIME value (MPAS-Dev/MPAS-Tools#347 and MPAS-Dev/MPAS-Tools#341) * Improved performance for interpolation of meshDensity and bathymetry (MPAS-Dev/MPAS-Tools#344) * Reorganization of `mpas_tools.mesh.creation` (MPAS-Dev/MPAS-Tools#314)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
scipyinterpolators are quite slow and inefficient. For bilinear interpolation on a regular grid, it is much more efficient to usenumpy.interpin 1D to set up coefficients for doing 2D, bilinear interpolation. A new functionmpas_tools.mesh.interpolation.interp_bilin()is added to do this.