Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fbe181c
rework file initialization to add some of necessary components of san…
amoodie Jan 29, 2026
1bb2144
add longname for all metadata.
amoodie Jan 31, 2026
9e8b96b
roll legacy dimensions to be time, now seconds
amoodie Jan 31, 2026
b054cd8
implement dictionary based output for all variables, still using list…
amoodie Jan 31, 2026
61271dd
working to implement dict based specification for output files.:
amoodie Feb 2, 2026
55657aa
add tests for legacy meta field, update name in netcdf to auxdata.
amoodie Feb 2, 2026
e88907d
update tests for checks of new format and new legacy format.
amoodie Feb 2, 2026
297806b
update example with long_name
amoodie Feb 2, 2026
388fd69
strip extra legacy warning from model property instantiation and inst…
amoodie Feb 2, 2026
0583529
update legacy tests to pass without warnings.
amoodie Feb 2, 2026
e1012cd
improving and updating documentation around this change to output net…
amoodie Feb 2, 2026
b3b10ec
increment minor version number. This is a change to the default outpu…
amoodie Feb 2, 2026
641e824
fix checkpointing, add test for legacy checkpoints.
amoodie Feb 2, 2026
09dfde5
fix typos and formatting in example.
amoodie Feb 2, 2026
4cc5feb
docstring formatting
amoodie Feb 3, 2026
5527bf6
fix integration tests to pass under new auxdata and seconds names
amoodie Feb 3, 2026
d86a5e1
typo
amoodie Feb 9, 2026
ecb82b9
add handling to iteration and init for lists and dicts
amoodie Feb 9, 2026
9c1da02
refactor for flexible and consistent name and dimensions use.
Feb 10, 2026
fb6f27c
add tests, including test of specification None for list.
Feb 10, 2026
259e4ee
add warning for deprecated None as input, change defaults, and update…
Feb 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions docs/source/examples/custom_saving.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ For example, ``self._save_fig_list['active_layer'] = ['active_layer']`` will pro
When adding variables or metadata to be initialized and subsequently saved in the output netCDF, the key-value pair relationship is as follows.
The key added to ``self._save_var_list`` is the name of the variable as it will be recorded in the netCDF file, this *does not* have to correspond to the name of an attribute in the model.
To add a variable to the metadata, a key must be added to ``self._save_var_list['meta']``.
The expected value for a given key is a list containing strings indicating the model attribute to be saved, its units, the variable type, and lastly the variable dimensions (e.g., ``['active_layer', 'fraction', 'f4', ('time', 'x', 'y')]`` for the active layer).
The expected value for a given key is a list containing strings indicating the model attribute to be saved, its units, the variable type, and lastly the variable dimensions (e.g., ``['active_layer', 'fraction', 'f4', ('seconds', 'x', 'y')]`` for the active layer).

.. important::

The dimensions of the custom variable being specified must match *exactly* with one of the three standard dimensions: `x`, `y`, `time`.
The dimensions of the custom variable being specified must match *exactly* with one of the three standard dimensions: `x`, `y`, `seconds`.
Use of an invalid dimension will result in an error.

An example of using the hook and creating a model subclass to customize the figures, gridded variables, and metadata being saved is provided below.
Expand All @@ -48,14 +48,19 @@ An example of using the hook and creating a model subclass to customize the figu
... self._save_fig_list['active_layer'] = ['active_layer']
...
... # save the active layer grid each save_dt w/ a short name
... self._save_var_list['actlay'] = ['active_layer', 'fraction',
... 'f4', ('time',
... 'x', 'y')]
... self._save_var_list['actlay'] = [
... 'active_layer', 'fraction',
... 'f4', ('seconds', 'x', 'y'),
... 'channel_bottom__sediment__active_layer'
... ]
...
... # save number of water parcels w/ a long name
... self._save_var_list['meta']['water_parcels'] = ['Np_water',
... 'parcels',
... 'i8', ()]
... self._save_var_list['meta']['water_parcels'] = [
... 'Np_water',
... 'parcels',
... 'i8', (),
... 'model_water__number_parcels'
... ]

Next, we instantiate the model class.

Expand Down Expand Up @@ -83,4 +88,4 @@ For simplicity we will just check that the appropriate parameters were added to
{'active_layer': ['active_layer']}

>>> print(mdl._save_var_list)
{'meta': {'water_parcels': ['Np_water', 'parcels', 'i8', ()]}, 'actlay': ['active_layer', 'fraction', 'f4', ('time', 'x', 'y')]}
{'meta': {'water_parcels': ['Np_water', 'parcels', 'i8', (), 'model_water__number_parcels']}, 'actlay': ['active_layer', 'fraction', 'f4', ('seconds', 'x', 'y'), 'channel_bottom__sediment__active_layer']}
34 changes: 20 additions & 14 deletions docs/source/info/outputfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,35 @@ Gridded Variables

In any given run, the saving parameters "save_<var>_grids" control whether or
not that 2-D grid variable (e.g. velocity) is saved to the netCDF4 file. In
the netCDF4 file, a 3-D array with the dimensions `time` :math:`\times`
the netCDF4 file, a 3-D array with the dimensions `seconds` :math:`\times`
`x` :math:`\times` `y` is created for each 2-D grid variable that is set to
be saved. Note that `x` is the *downstream* coordinate, rather than the
Cartesian `x` when displaying the grid. The appropriate units for all
variables are stored: for example "meters per second" for the *velocity*
grid.
grid. All variables include a description via the `long_name` attribute.

.. note::
.. important::

The format of the output netCDF file coordinate changed in `v2.1.0`. The
old format is documented
in :attr:`~pyDeltaRCM.model.DeltaModel.legacy_netcdf`, and that input
parameter `legacy_netcdf` can be used to create on output netcdf file with
the old coordinate configuration.
The format of the output netCDF file coordinates changed in `v2.2.0`. The
old format (up to v2.1.9) is documented
in :attr:`~pyDeltaRCM.model.DeltaModel.legacy_netcdf`, and the input
parameter `legacy_netcdf` can be used to create an output netcdf file with
the old coordinate configuration. The output format for pyDeltaRCM v2.1.0
and earlier is deprecated and has been removed. Changing to the new output
format should be a small change for most users, with only the name of the
temporal dimension and the metadata subgroup changing in the new output.


Grid Coordinates
================

Grid coordinates are specified in the variables `time`, `x`, and `y` in the output netCDF4 file.
These arrays are 1D arrays, which specify the location of each cell in the domain in *dimensional* coordinates (e.g., meters).
In the downstream direction, the distance of each cell from the inlet boundary is specified in `x` in meters.
Similarly, the cross-domain distance is specified in `y` in meters.
Lastly, the `time` variable is stored as a 1D array with model `time` in seconds.
Grid coordinates are specified in the variables `seconds`, `x`, and `y` in the
output netCDF4 file. These arrays are 1D arrays, which specify the location
of each cell in the domain in *dimensional* coordinates (e.g., meters). In
the downstream direction, the distance of each cell from the inlet boundary
is specified in `x` in meters. Similarly, the cross-domain distance is
specified in `y` in meters. Lastly, the `seconds` variable is stored as a 1D
array recording model elapsed time in seconds.


Model Metadata
Expand All @@ -53,6 +58,7 @@ saved as metadata are the following:
- Sediment concentration: `C0_percent`
- Characteristic Velocity: `u0`
- If subsidence is enabled:

- Subsidence start time: `start_subsidence`
- Subsidence rate: `sigma`

Expand All @@ -66,7 +72,7 @@ library. These libraries range from the
to higher-level libraries such as
`xarray <https://github.com/pydata/xarray>`_. For deltas, and specifically
*pyDeltaRCM*, there is also a package under development called
`DeltaMetrics <https://github.com/DeltaRCM/DeltaMetrics>`_,
`sandplover <https://github.com/sandpiper-toolchain/sandplover>`_,
that is being designed to help post-process and analyze *pyDeltaRCM* outputs.


Expand Down
2 changes: 1 addition & 1 deletion pyDeltaRCM/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ def __version__() -> str:
Private version declaration, gets assigned to pyDeltaRCM.__version__
during import
"""
return "2.1.9"
return "2.2.0"
2 changes: 1 addition & 1 deletion pyDeltaRCM/hook_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def hook_init_output_file(self) -> None:
.. note::

For a vector of time-varying metadata, the dimension
should be specified as ('total_time').
should be specified as ('time').

Expected format for time varying grid entries as keys within the
`self._save_var_list` dictionary:
Expand Down
Loading
Loading