-
Notifications
You must be signed in to change notification settings - Fork 87
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
improvements to fgout_module for t arrays and D-Claw #617
Merged
Conversation
This file contains 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
and support in fgout_tools.py for new dclaw attribute dclaw to set in setrun.py to indicate D-Claw, in which case 7 components of q are output instead of 4. Support for eventually indicating fewer components to output.
I plan to merge this for now, and work on additional updates later - see #618 @kbarnhart, let me know if you run into problems using this. |
rjleveque
changed the title
WIP: improvements to fgout_module for t arrays and D-Claw
improvements to fgout_module for t arrays and D-Claw
Jun 11, 2024
@rjleveque Thanks! Will let you know if I run into issues. |
rjleveque
added a commit
to rjleveque/geoclaw
that referenced
this pull request
Jun 19, 2024
Now that `output_style==2` is supported for fgout grids (an array of times, see clawpack#617), the function fgout_tools.FGoutGrid.read_fgout_grids_data needs to be fixed to properly read in the new format of `fgout_grids.data`, also note that `nout` now comes before `tstart` and `tend` for `output_style==1`.
bolliger32
added a commit
to ClimateImpactLab/geoclaw
that referenced
this pull request
Jul 9, 2024
* change nodata_value to -99999 in topotools Previous value -9999 did not have enough digits since new etopo 2022 data has this as an actual topography value in the Mariana Trench (when written with `Z_format='%.0f'`). * Fix bug related to tracking pressure at gauges * simplify make_fgout_animation.py use of update_artists These do not need to be passed into update, unpacked, and repacked, since the objects created in the script will be used into update. If blit==False then they are not needed at all. * use image backend Agg in make_fgout_animation.py so animation size agrees with specified figure size * set blit=False and auto-detect number of fgout frames * clean up make_fgout_animation.py * added new chile2010_fgmax-fgout/make_fgout_animation_with_transect.py * Add dZ_format parameter to DTopography.write function The default is now '%.3f', millimeter resolution, making smaller dtopo files than previously. * handle 0 radius * fix type on set_pressure * fix duplicate r * make comparison fp-safe * handle underflow * avoid underflow in wind setting too * point to riemann/src for Riemann solvers * Remove Riemann solvers from src/2d/bouss, Makefile.common points to riemann/src Note that rpn2_geoclaw.f and geoclaw_riemann_utils.f were update in riemann/src to handle 5 waves and rpt2_geoclaw_sym.f was discarded in favor of standard rpt2.f, which works fine with 5 waves. * Initial CI GitHub action script * Update testing.yml * Add checking out of clawpack and geoclaw * Add lint and testing to CI * Disable linting for the time being * Re-enable linting but only for geoclaw * Exclude old_topotools.py Do not want to touch the old topotools file for reference. * Fix up gauge plotting for storm surge Includes a couple of minor bugs related to gauge plotting. Major change involves how we now plot the gauge data. * Add dry gauge plotting * create gauge filenames that allow more than 5 digits in gauge number If fewer than 5 digits, still add zero padding e.g. gauge00012.txt but no longer throws an error for large gauge numbers, e.g. gauge1234567.txt * cleaner way to zero pad only if fewer than 5 digits using I0.5 format * Cleanup and reimplement reading of ATCF and writing of GeoClaw storms * Minor string comparison bug fix * Extract name of storm from file name * Minor tweaks and fixes * Fix missing comma * AutoPEP8 surge code * add fgout output_style parameter and support for array of output_times * remove trailing whitespaces in fgout_module.f990 * Refactor fgout_module.f90 so it works for either GeoClaw or D-Claw and support in fgout_tools.py for new dclaw attribute dclaw to set in setrun.py to indicate D-Claw, in which case 7 components of q are output instead of 4. Support for eventually indicating fewer components to output. * Use geoclaw module rho * Remove module level parameters that were not needed or were specific These mostly pertained to the CLE code. * Initial implementation of rotation control * Minor bugfixes and rearranging * Fix bugs in the non-spherical coordinates for storms" * fix fgout_tools.FGoutGrid.read_fgout_grids_data for time array Now that `output_style==2` is supported for fgout grids (an array of times, see clawpack#617), the function fgout_tools.FGoutGrid.read_fgout_grids_data needs to be fixed to properly read in the new format of `fgout_grids.data`, also note that `nout` now comes before `tstart` and `tend` for `output_style==1`. --------- Co-authored-by: Randy LeVeque <[email protected]> Co-authored-by: Kyle Mandli <[email protected]>
bolliger32
added a commit
to ClimateImpactLab/geoclaw
that referenced
this pull request
Oct 14, 2024
* change nodata_value to -99999 in topotools Previous value -9999 did not have enough digits since new etopo 2022 data has this as an actual topography value in the Mariana Trench (when written with `Z_format='%.0f'`). * Fix bug related to tracking pressure at gauges * simplify make_fgout_animation.py use of update_artists These do not need to be passed into update, unpacked, and repacked, since the objects created in the script will be used into update. If blit==False then they are not needed at all. * use image backend Agg in make_fgout_animation.py so animation size agrees with specified figure size * set blit=False and auto-detect number of fgout frames * clean up make_fgout_animation.py * added new chile2010_fgmax-fgout/make_fgout_animation_with_transect.py * Add dZ_format parameter to DTopography.write function The default is now '%.3f', millimeter resolution, making smaller dtopo files than previously. * handle 0 radius * fix type on set_pressure * fix duplicate r * make comparison fp-safe * handle underflow * avoid underflow in wind setting too * point to riemann/src for Riemann solvers * Remove Riemann solvers from src/2d/bouss, Makefile.common points to riemann/src Note that rpn2_geoclaw.f and geoclaw_riemann_utils.f were update in riemann/src to handle 5 waves and rpt2_geoclaw_sym.f was discarded in favor of standard rpt2.f, which works fine with 5 waves. * Initial CI GitHub action script * Update testing.yml * Add checking out of clawpack and geoclaw * Add lint and testing to CI * Disable linting for the time being * Re-enable linting but only for geoclaw * Exclude old_topotools.py Do not want to touch the old topotools file for reference. * initial commit of xarray backends and example use file * remove extra words * relax assumption of where command is issued (no longer needs to be in run directory). * Fix up gauge plotting for storm surge Includes a couple of minor bugs related to gauge plotting. Major change involves how we now plot the gauge data. * Add dry gauge plotting * create gauge filenames that allow more than 5 digits in gauge number If fewer than 5 digits, still add zero padding e.g. gauge00012.txt but no longer throws an error for large gauge numbers, e.g. gauge1234567.txt * cleaner way to zero pad only if fewer than 5 digits using I0.5 format * Cleanup and reimplement reading of ATCF and writing of GeoClaw storms * Minor string comparison bug fix * Extract name of storm from file name * Minor tweaks and fixes * Fix missing comma * AutoPEP8 surge code * add more information about rioxarray * better import error for rioxarray * add B and level * add fgout output_style parameter and support for array of output_times * remove trailing whitespaces in fgout_module.f990 * Refactor fgout_module.f90 so it works for either GeoClaw or D-Claw and support in fgout_tools.py for new dclaw attribute dclaw to set in setrun.py to indicate D-Claw, in which case 7 components of q are output instead of 4. Support for eventually indicating fewer components to output. * Use geoclaw module rho * Remove module level parameters that were not needed or were specific These mostly pertained to the CLE code. * Initial implementation of rotation control * Minor bugfixes and rearranging * Fix bugs in the non-spherical coordinates for storms" * fix fgout_tools.FGoutGrid.read_fgout_grids_data for time array Now that `output_style==2` is supported for fgout grids (an array of times, see clawpack#617), the function fgout_tools.FGoutGrid.read_fgout_grids_data needs to be fixed to properly read in the new format of `fgout_grids.data`, also note that `nout` now comes before `tstart` and `tend` for `output_style==1`. * Add kwargs to Topography reading * Add radii to plotting options * Add plotting of storm tracks * add clip example * return ds * Allow specifying which components of q to output on each fgout grid Modifications to fgout_module.f90 and fgout_tools.py, primarily. Can now set `fgout.q_out_vars` to a list of which components of q to output for each fgout frame (Fortran indexing). The default is `fgout.q_out_vars = [1,2,3,4]` for all components of q[1:3] and also eta (4), consistent with the previous behavior. The user could also/instead ask to output the topo B as component 5. (If two out of three of h, eta, B are output then the other can be computed from these.) Note that this list is written out to `fgout_grids.data` rather than a boolean list of True/False values for each possible component as is done in other places in GeoClaw. * working on dclaw variables * Fix fgout_tools.py to support fgout.q_out_vars also for Boussinesq or D-Claw When instantiating fgout_tools.FGoutGrid object, new qmap parameter can be set to 'geoclaw', 'geoclaw-bouss', 'dclaw', or a custom dictionary. (Eventually add 'dclaw-bouss' option also). This dictionary has the form `{'h':1, 'hu':2, etc}` with mapping from fgout variable names to Fortran indices of q in the code creating the fgout output. * Update topo_module.f90 The `character` variables that were storing variable names and IDs for NetCDF topography reading were only length 10. This just makes them 64 characters long. Probably too long but not really a big deal. * fix data_file -> data_path * add FGoutGrid.read_fgout_grids_data_pre511 for reading legacy fgout_grids.data from before v5.11 * add to doc string for pre511 * print more helpful error msg if fgout_grids.data seems to be pre511 * force user to call read_fgout_grids_data before read_frame * Fix chiles2010_fgmax-fgout scripts to make fgout animations Now need to call fgout_grid.read_fgout_grids_data() explicitly, but do not need to set format. * Leave output_format as an argument to FGoutGrids.__init__ but not that this is ignored since it is read from fgout_grids.data. Also properly handle output_format == 2 for binary32. * fix qmap=='geoclaw-bouss' mapping * wip * first pass at using revised fgout data structure with backends. * add a few more comments. * name updates * bdiff->bdif * remove vestigial _qelements * Add example that should work with/without dask * improve drytol handling (now tested for both absence of h, and absence of h, eta, and B) * don't specify error type. * switch from hard coded drytol to user-specified drytol * update use of dry_tolerance * fix exceptions. * update examples/tsunami/chile2010/setplot.py Improve this by using new options added in recent releases so the plots look better and this can better serve as a template for other problems. * Fix src/bouss/amr2.f90 call to set_fgout, adding nvar This was modified in the shallow/amr2.f90 code to support more fgout flexibility in clawpack#624, and this change is also required in the bouss version. Also enhanced the examples/bouss README files a bit. --------- Co-authored-by: Randy LeVeque <[email protected]> Co-authored-by: Kyle Mandli <[email protected]> Co-authored-by: Barnhart, Katherine (Katy) Ruth <[email protected]>
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.
Allow specifying
fgout.output_times
as a general list or array of times rather than equally spaced, if you setfgout.output_style = 2
. The default isfgout.output_style = 1
that takes the previous input. Changes tofgout_tools.py
allow specifying these values insetrun.py
.Then we also made this more general so that it could handle D-Claw output as well as GeoClaw, with a new attribute
fgout.dclaw
that isFalse
by default, but setting this toTrue
outputs 7 components ofq
instead of only 3 (pluseta
in both cases).I plan to also modify this so that you can specify fewer components rather than all of them.
Also cleaned up a bunch of trailing white space.