Skip to content
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

Convert output to user requested units #392

Closed
Tracked by #378
dschlaep opened this issue Apr 16, 2024 · 0 comments · Fixed by #393
Closed
Tracked by #378

Convert output to user requested units #392

dschlaep opened this issue Apr 16, 2024 · 0 comments · Fixed by #393

Comments

@dschlaep
Copy link
Member

Convert netCDF output to user requested units (field "netCDF units" of input file "SW2_netCDF_output_variables.tsv") if compiled against the udunits2 library

@dschlaep dschlaep added this to the Release v8.0.0 milestone Apr 16, 2024
@dschlaep dschlaep self-assigned this Apr 16, 2024
@dschlaep dschlaep mentioned this issue Apr 16, 2024
14 tasks
dschlaep added a commit that referenced this issue Apr 16, 2024
- addressing issue #392

- unit conversion is activated if compiled with `CPPFLAGS='-DSWNETCDF -DSWUDUNITS' make all` (additional flags available to specify paths for udunits2 headers and libraries, see makefile)
- users request output units via field "netCDF units" of input file "SW2_netCDF_output_variables.tsv"; internal units are used if user requested units cannot be converted from internal units

- SOILWAT2 internal units (text string) are stored in the attribute "units_sw" of struct "SW_OUTPUT" for each (netCDF) output variable
- udunits2 unit converters are stored in the attribute "uconv" of struct "SW_OUTPUT" for each (netCDF) output variable

- new SW_NC_create_units_converters() creates udunits2 unit converters from internal units to user requested output units
- SW_NC_write_output() converts units before writing to netCDF output files if a unit converter is available (if no unit converter is available, then output is written using internal units)
- SW_NC_dealloc_outputkey_var_info() de-allocates unit converter memory
dschlaep added a commit that referenced this issue Apr 16, 2024
Convert output to user requested units (#392)
dschlaep added a commit that referenced this issue Apr 30, 2024
Output netCDFs

close #363 

* All outputs are written to `"netCDF"` files based on user requests from `"SW2_netCDF_output_variables.tsv"` (#363; @dschlaep, @N1ckP3rsl3y). `"netCDF"` output files combine output variables by output group `"outkey"` and output period (daily, weekly, monthly, yearly).
* New tab-separated value `"tsv"` input file `"SW2_netCDF_output_variables.tsv"` that lists, activates, and describes each output variable in `"netCDF"` mode.
* SOILWAT2 can now be compiled with `"udunits2"` to convert output to user requested units (#392; @dschlaep, @N1ckP3rsl3y).
    * Unit conversion is available only in `"netCDF"`-mode and if compiled with the new preprocessor definition `"SWUDUNITS"` and if the `"udunits2"` library is available, e.g., `CPPFLAGS='-DSWNETCDF -DSWUDUNITS' make all`.
    * Users request output units via field `"netCDF units"` of the input file `"SW2_netCDF_output_variables.tsv"`.
* The random number generator `"pcg"` is now a submodule of a forked copy of the previous repository `imneme/pcg-c-basic` (#353; @dschlaep). This allowed us to fix a function declaration without a prototype.
@dschlaep dschlaep closed this as completed Jun 5, 2024
@dschlaep dschlaep linked a pull request Jun 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant