Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature nc units #393

Merged
merged 3 commits into from
Apr 16, 2024
Merged

Feature nc units #393

merged 3 commits into from
Apr 16, 2024

Conversation

dschlaep
Copy link
Member

Convert output to user requested units (#392)

- 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 dschlaep changed the base branch from feature_nc_output to release/devel_v8.0.0 April 16, 2024 16:09
@dschlaep dschlaep closed this Apr 16, 2024
@dschlaep dschlaep reopened this Apr 16, 2024
@dschlaep dschlaep changed the base branch from release/devel_v8.0.0 to master April 16, 2024 19:19
@dschlaep dschlaep changed the base branch from master to release/devel_v8.0.0 April 16, 2024 19:20
Copy link

codecov bot commented Apr 16, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 72.74%. Comparing base (055bb84) to head (303e771).

Files Patch % Lines
src/SW_Flow_lib.c 44.44% 5 Missing ⚠️
src/SW_Files.c 73.33% 4 Missing ⚠️
src/SW_Control.c 57.14% 3 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##           release/devel_v8.0.0     #393      +/-   ##
========================================================
- Coverage                 72.80%   72.74%   -0.06%     
========================================================
  Files                        20       20              
  Lines                      5640     5646       +6     
========================================================
+ Hits                       4106     4107       +1     
- Misses                     1534     1539       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dschlaep dschlaep changed the base branch from release/devel_v8.0.0 to feature_nc_output April 16, 2024 21:38
@dschlaep dschlaep merged commit 4c1beb7 into feature_nc_output Apr 16, 2024
6 of 8 checks passed
@dschlaep dschlaep deleted the feature_nc_units branch April 16, 2024 21:42
@dschlaep dschlaep linked an issue Jun 5, 2024 that may be closed by this pull request
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert output to user requested units
1 participant