Update ngen to generate catchment output variables in a combined netCDF file (NGWPC-9011)#106
Update ngen to generate catchment output variables in a combined netCDF file (NGWPC-9011)#106sivasankkar wants to merge 15 commits intodevelopmentfrom
Conversation
src/NetCDFCreator.cpp
Outdated
|
|
||
| NetCDFCreator::NetCDFCreator(std::shared_ptr<realization::Formulation_Manager> manager, | ||
| const std::string& output_name,Simulation_Time const& sim_time) | ||
| :catchmentNcFile_(manager->get_output_root() + output_name + ".nc",NcFile::replace) |
There was a problem hiding this comment.
Creating the file in an initializer means that we can't catch and report errors that might arise.
src/NetCDFCreator.cpp
Outdated
|
|
||
| NetCDFCreator::NetCDFCreator(std::shared_ptr<realization::Formulation_Manager> manager, | ||
| const std::string& output_name,Simulation_Time const& sim_time) | ||
| :catchmentNcFile_(manager->get_output_root() + output_name + ".nc",NcFile::replace) |
There was a problem hiding this comment.
The file creation (and subsequent writing) needs to be coordinated across MPI processes. One process will do the creation, and then every other process will open the already-created file.
That would be a reason to not do any of the file initialization in the constructor. Instead, from main():
- Every process constructs an instance of the
NetCDFWriter - Process with
rank == 0calls the creation/initialization method - Every process calls
MPI_Barrier - Every process (maybe,
rank != 0) calls the open method to get theNcFilehandle - Maybe they all load the
NcVars for each variable to be written.
They then later use the open NcFile to putVar individual catchment variables, presumably using the same indexes established for t-route. Maybe the initialization method mentioned above writes a catchment_labels variable to ensure they can be identified later.
include/core/NetCDFCreator.hpp
Outdated
| std::shared_ptr<Simulation_Time> sim_time_; | ||
| NcDim timeDim; | ||
| NcDim catchmentsDim; | ||
| std::map<std::string, std::shared_ptr<realization::Catchment_Formulation>> formulations; |
There was a problem hiding this comment.
This is what Formulation_Manager already owns. Why it is being duplicated?
…GWPC/ngen into ssn_9011_netcdf_for_catchments
…Creator. Currently, the code is skeletal with the focus on getting a successful compile.
…he program compilable.
… single process. Also, removed an unused function from the test class.
…ingle NetCDF in parallel fashion.
…etCDF creation. Added appropriate log messages.
| std::string catchment_id = catchment_val.first; | ||
|
|
||
| //iterate through catchment dimension to find the index of the catchment for writing. | ||
| //also split the comma separated outputs string to a vector of double values |
There was a problem hiding this comment.
Why is this feature designed as taking the string formatted outputs, and then re-parsing them to numeric values? Why are the numeric values not carried from the calculation straight to this output?
Enable functionality in ngen to write all catchment outputs to a netcdf file.
Additions
Removals
Changes
get_output_variable_unitsandset_output_variable_unitsfunction to obtain the output variable units to write to netcdf attributes.Testing
Screenshots
Notes
Todos
Checklist
Testing checklist (automated report can be put here)
Target Environment support