-
Notifications
You must be signed in to change notification settings - Fork 90
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
Allow specifying which components of q to output on each fgout grid #624
Conversation
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.
… 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.
This has been updated to handle Bouss and D-Claw. When instantiating |
…rids.data from before v5.11
Now need to call fgout_grid.read_fgout_grids_data() explicitly, but do not need to set format.
this is ignored since it is read from fgout_grids.data. Also properly handle output_format == 2 for binary32.
I fixed a few issues and I think this is ready to merge. I also updated the documentation, see |
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.
* 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]>
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 isfgout.q_out_vars = [1,2,3,4]
for all components of q[1:3] and also eta (4), consistent with the previous behavior on standard GeoClaw.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. This turned out to be both easier and clearer.I got rid of the
fgout.dclaw
parameter that was introduced in #617 and all the complication of hard-wiring different sets of variables for geoclaw vs dclaw since this should now allow much more control to use either as well as reducing the size of fgout files when only a few components are desired.For the Boussinesq version of GeoClaw, there are 6 variables in q and so to print out only h,hu,hv,eta you would specify
fgout.q_out_vars = [1,2,3,7]
, or just[1,7]
if you do not want to write the momenta and only want h,eta.Needs some more testing still and I'd be happy for feedback.