-
Notifications
You must be signed in to change notification settings - Fork 25
Topochanges - WIP #245
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
Open
rjleveque
wants to merge
2
commits into
clawpack:dev
Choose a base branch
from
rjleveque:topochanges
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Topochanges - WIP #245
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,155 @@ | ||
| .. _topochanges: | ||
|
|
||
| ***************************************************************** | ||
| Changes to topo and dtopo handling (planned for v5.15.0) | ||
| ***************************************************************** | ||
|
|
||
| Many changes are being implemented in the way topo and dtopo | ||
| files are handled, in both the Python tools and the Fortran code. | ||
|
|
||
| .. warning :: Some of this work is still being debugged and code | ||
| on the master branch may not work as advertised. Interfaces | ||
| and parameter names are still evolving. Please test this code | ||
| but be aware of these warnings. | ||
|
|
||
| .. seealso:: | ||
| - :ref:`topotools` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some of these do not exist yet. |
||
| - :ref:`topodata_format` | ||
| - :ref:`netcdf_input` | ||
| - :ref:`topotools` | ||
| - :ref:`topo_order` | ||
| - :ref:`dtopo` | ||
| - :ref:`dtopotools` | ||
|
|
||
| Major changes to topo file handling | ||
| =================================== | ||
|
|
||
| Cropping and coarsening or minor adjustments to a topo DEM | ||
| ---------------------------------------------------------- | ||
|
|
||
| In the Fortran GeoClaw code, rather than specifying a list of | ||
| topo files in `setrun.py`, we now list a set of topo grids. | ||
| Each topography grid comes from a particular file, but has | ||
| additional parameters indicating if the DEM in the file should | ||
| be cropped or coarsened to create the topo grid (along with | ||
| other options, such as shifting the longitude by 360 degrees | ||
| or shifting the values vertically). | ||
|
|
||
| This has several advantages: | ||
|
|
||
| - A single large topo DEM can be dynamically cropped and coarsened | ||
| as needed, rather than potentially needing to make many smaller | ||
| files with different extents or resolutions. The same DEM can | ||
| be used multiple times in the `setrun.py` to specify different | ||
| topo grids with different extents and coarsening factors, if | ||
| desired. | ||
|
|
||
| - If the same topo file is needed sometimes in latitude W (e.g. | ||
| in modeling a nearfield tsunami on the US West Coast) and sometimes | ||
| in longitude E (e.g. when modeling a farfield tsunami from Japan), | ||
| you no longer need two versions of the large file with only one | ||
| change in the header. | ||
|
|
||
| See :ref:`setrun_topo_preprocessing` for a full attribute table with types | ||
| and defaults, and non-obvious behavior notes. | ||
|
|
||
| NetCDF file handling | ||
| -------------------- | ||
|
|
||
| Improvements have also been made in how netCDF files are used | ||
| in both Python and Fortran. See :ref:`netcdf_input`. | ||
|
|
||
|
|
||
|
|
||
| Ordering of topo DEM priorities | ||
| ------------------------------- | ||
|
|
||
| When creating grid cell topo values, normally the topo grids specified | ||
| are used with the finest available grid having highest priority. | ||
| However, this can be over-ridden as is sometime necessary as described | ||
| in :ref:`topo_order`. Previously the ordering was figured out in the | ||
| Fortran code. Now the ordering is figured out in Python, in the process | ||
| of generating `topo.data` from `setrun.py`, and the order the grids | ||
| are listed in `topo.data` is exactly the order that will be used in | ||
| the Fortran code. This should make it easier for the user to confirm | ||
| the desired ordering is being used. | ||
|
|
||
|
|
||
| Major changes to dtopo file handling | ||
| ==================================== | ||
|
|
||
| NetCDF file handling | ||
| -------------------- | ||
|
|
||
| Improvements have also been made in how netCDF files are used | ||
| in both Python and Fortran. See :ref:`netcdf_input`. | ||
|
|
||
|
|
||
|
|
||
| Copied from :ref:`changes_to_master` | ||
| ==================================== | ||
|
|
||
|
|
||
| - **Topography preprocessing attributes.** | ||
| :class:`~clawpack.geoclaw.topotools.Topography` now supports seven | ||
| preprocessing attributes (``crop_extent``, ``coarsen``, ``buffer``, | ||
| ``align``, ``x_shift``, ``z_shift``, ``negate_z``) that are applied | ||
| automatically when :meth:`~clawpack.geoclaw.topotools.Topography.read` | ||
| loads a file. See :ref:`setrun_topo_preprocessing` for the full table | ||
| and :ref:`topotools` for usage examples and operation order. | ||
|
|
||
| - **CF-aware NetCDF reading.** | ||
| NetCDF topography files (``topo_type=4``) are now read via | ||
| :class:`~clawpack.geoclaw.netcdf_utils.TopoInspector`, which auto-detects | ||
| coordinate variable names using CF conventions (``standard_name``, ``axis``, | ||
| and common fallback names). Files with non-standard coordinate names and | ||
| non-standard dimension orders are handled automatically. | ||
| :meth:`~clawpack.geoclaw.topotools.Topography.read_header` also uses CF | ||
| detection for type-4 files, enabling a lazy-load pattern where coordinates | ||
| are available without loading the elevation array. | ||
| See :ref:`topotools` for an example. | ||
|
|
||
| - **Python-owned priority ordering.** | ||
| Topography files in ``topo.data`` are now sorted entirely in Python by | ||
| :meth:`~clawpack.geoclaw.data.TopographyData._compute_priority_order` | ||
| before writing. Files are written coarsest-first (finest last), matching | ||
| the traditional GeoClaw listing order; the last file listed in ``topo.data`` | ||
| is assigned rank 1 (highest priority) by Fortran, with no Fortran-side | ||
| sorting. ``rundata.topo_data.override_order = True`` preserves | ||
| user-specified list order; when used, the finest (highest-resolution) file | ||
| should be listed last. See :ref:`topo_order`. | ||
|
|
||
| - **topo_type=1 deprecated.** | ||
| Reading and writing ``topo_type=1`` (``x y z`` one-point-per-line ASCII) | ||
| now emit a ``DeprecationWarning``. Setting any preprocessing attribute | ||
| before reading a type-1 file raises ``NotImplementedError``. To convert:: | ||
|
|
||
| topo = Topography() | ||
| topo.read('old.tt1', topo_type=1) # gives DeprecationWarning | ||
| topo.write('new.tt2', topo_type=2) | ||
|
|
||
| - **New** ``topo.data`` **format.** | ||
| Each per-file block in ``topo.data`` now contains 9 lines (up from 2), | ||
| recording all preprocessing attributes. See :ref:`topodata_format` for | ||
| the complete format specification. | ||
|
|
||
| - **dtopo NetCDF (**\ ``dtopo_type=4``\ **).** | ||
| :class:`~clawpack.geoclaw.dtopotools.DTopography` reads and writes | ||
| CF-compliant NetCDF dtopo files. The optional ``time_reference`` attribute | ||
| selects a CF datetime time axis (``units = "seconds since <ref>"``) that a | ||
| plain ``xarray.open_dataset`` decodes to ``datetime64``; without it a bare | ||
| ``units = "seconds"`` (simulation-relative) axis is written. The reader | ||
| scales the time axis by its CF ``units``, fixing an earlier bug where a | ||
| ``"hours"``/``"minutes"`` axis was misread as seconds. See | ||
| :ref:`netcdf_input` and :ref:`dtopo_formats`. | ||
|
|
||
| - **NetCDF write dtype control.** | ||
| ``Topography.write(topo_type=4, z_dtype=...)`` and | ||
| ``DTopography.write(dtopo_type=4, dz_dtype=...)`` override the on-disk | ||
| elevation/deformation dtype (default ``"float32"``; pass ``"float64"`` for | ||
| full double precision). | ||
|
|
||
| - **Robust NetCDF file opening.** | ||
| A NetCDF backend engine is now selected explicitly, so a valid file opens | ||
| even when its name uses a non-standard extension (e.g. ``.dtt3``) that | ||
| xarray's extension-based engine guessing would not recognize. | ||
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
Oops, something went wrong.
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.
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.
As we discussed, should this be a
Warninginstead of aDeprecationWarning?