-
Notifications
You must be signed in to change notification settings - Fork 2
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
Development towards v8.0.0 #378
Merged
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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #378 +/- ##
==========================================
+ Coverage 71.00% 73.00% +1.99%
==========================================
Files 21 20 -1
Lines 5591 6005 +414
==========================================
+ Hits 3970 4384 +414
Misses 1621 1621 ☔ View full report in Codecov by Sentry. |
- New function `fill_domain_netCDF_vars()` which fill specific variables within the generated domain netCDF file with values * Fills horizontal coordinate variables with upper/lower bound coordinates provided by the user * Fills the domain variable with SUIDs * Fills the "site" variable with site numbers (same as SUIDs) if applicable - New functions that are general purpose to help this function * `fill_netCDF_var_uint()` - Fills a variable with unsigned integer values * `fill_netCDF_var_double()` - Fills a variable with double values - Modify `fill_domain_netCDF_*()` to return lat/lon variable IDs - `SW_NC_create_domain_template()` * Update calls to helper functions * Add call to `fill_domain_netCDF_vars()` * Add the closing of the domain file when exiting early - Moved the calculation of number of SUIDs to before the domain netCDF is generated
- Calculate global nc attribute "coordinate_system" from user inputs: primary CRS and provided CRS(s) -- instead of a separate user input
- error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *' - warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings] - warning: passing 'const int *' to parameter of type 'int *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] - and several similar errors/warnings -> define arrays as const that hold nc attributes and nc attribute values -> update arguments of function that deal with attributes, to be const where needed
- default inputs for the spatial bounding box now produce identical coordinates as previously (i.e., lat/lon coordinates from "modelrun.in")
`fill_domain_netCDF_xy()` - Now returns the variable IDs for "*_bnds" as a parameter `fill_domain_netCDF_vals()` - Renamed from `fill_domain_netCDF_vars()` - Correct error checking at the beginning after allocation - Now writes `*_bnds` values New function `alloc_netCDF_domain_vars()` - Allocates arrays for variables that will be written out, if a variable is not to be written out, it will not be allocated New function `dealloc_netCDF_domain_vars()` - Deallocates all arrays that were allocated within `alloc_netCDF_domain_vars()`
`fill_domain_netCDF_xy()` / `fill_domain_netCDF_s()` - Gains argument - units - for y/x variables - Correct lat/lon variable units ("degrees_*")
- New functions `SW_NC_init_ptrs()` and `SW_NC_deconstruct()` * Initialize pointers within the structs SW_NETCDF & SW_CRS * Free any memory that is allocated within the struct(s) - Functions are called in main() if SW_NETCDF is defined
- `SW_NC_check()` now accepts a file name for error description purposes - Function now makes sure that the following things are consistent between a given netCDF file and `domain.in` * Domain type (crs_bbox in `domain.in` and `long_name` in a netCDF file) * Dimensions (sites or latitude/longitude, may also be called "y" and "x") - New functions `get_dim_val()` * Uses new function `get_dim_identifier()` * Gets the ID of a dimension in a netCDF * Gets the value of a dimension within a netCDF, if it exists - New function `is_wgs84()` which checks to see if a "long_name" and/or "crs_bbox" are a synonym of "WGS84" - New function `varExists()` which tests to see if a specific variable exists within a netCDF file and does not report an error if the test fails
- Changed the variable `crs_bbox`'s memory from dynamic to static - 27 characters - which holds "World Geodetic System 1984" + null character - Two new functions that generalize the initialization of pointers and deconstruction of file information and netCDF information * `SW_DOM_init_ptrs()` & `SW_DOM_deconstruct()`
- Removed the function `SW_NC_read_domain()` and is replaced with `SW_NC_check()` - New functions * `get_var_identifier()` - Gets the variable ID from within a given netCDF file * `get_str_att_val()` - Gets the string value of an attribute * `get_double_att_val()` - Gets the double value of an attribute (can be an array) - Redo the code within `SW_NC_check()` to cover more cases like checking both projected and geographic CRS if provided - Remove rogue printf call - Remove const for strings in `is_wgs84()`
…p and main functionality
- Horizontal coordinate variables that are written to in the domain netCDF now depend on the CRS bounding box user input - Mostly replaced the checking of if the main CRS is a geographic one, we now get the bounding box CRS - Make sure the CRS bounding box name and one CRS long name match - Simplify the interfaces of functions that create/fill the variable (values) to use SW_DOMAIN - Update the documentation note of the function `fill_domain_netCDF_vals()` - Update the function mentioned in the call to `Mem_Malloc()` within `alloc_netCDF_domain_vars()`
- Fill the function `SW_NC_read_inputs()` to read the latitude/longitude from a file (currently only domain.nc) * Created a helper function - `get_single_double_val()` - which gets a single double value from a netCDF file - New functions * `SW_NC_open_files()` - Open files (currently only domain.nc) if they exist to read from * `SW_NC_close_files()` - Close all files that were left open during the program run (currently only domain.nc) - Changed the order of the calculated/translated SUID in `SW_DOM_calc_ncSuid()` for the netCDF library to properly use
- Cast "allocArr" to void - Change name "numFreeVars" to "numAllocVars" to be more appropriate
- Use the C-netCDF provided function `nc_def_var_deflate()` with the compression level of 5 (0 - 9)
- Change this name to be consistent with the rest of the programs SW_* argument names
- Adjust whitespace in some places to try to help with readability - Correct/modify some function documentation - Attempt to make long function calls fit within 80 characters - Make it so that all trinary operators have () around the conditional
- SW_OUTDOM_init_ptrs - Initialize pointers found in SW_OUT_DOM - SW_OUTDOM_deepCopy - Copies all pointers within SW_OUT_DOM, including SW_NETCDF information if defined
Reduce the copying of domain-specific information throughout simulation runs achieved by the changes * Rename SW_ALL to SW_RUN to clarify that the information within it is simulation-dependent (#412) * Remove SW_OUTPUT, SW_OUTPUT_POINTERS, SW_GEN_OUT * Create two new structs: SW_OUT_DOM and SW_OUT_RUN (#395)
…construct()` - Previously, the call to `memset()` would erase the information of `OutDom` when used with STEPWAT2 - STEPWAT2 will now handle the setting of this variable after the function call so that the call to `memset()` can stay
- Increase the buffer `varKey` and write size in `snprintf()` by one
- `SW_CTL_setup_model()` gains same parameter - Update calls to these functions with new boolean value
- previously, the makefile attempt (but failed) to modify user provided environmental variables `NC_LIBS` and `UD_LIBS` --> now, makefile first takes a local copy of the user provided environmental variables before modifying their content - previously, `EX_LIBS` was hard-coded to "-lexpat" (if undefined) which failed if the "expat" library was not on the search path (which was unnecessarily if udunits2 was statically compiled with the expat dependency) --> now, `EX_LIBS` remains undefined - previously, if `nc-config --cflags` provided non-include paths for `NC_CFLAGS`, then the guess for `UD_CFLAGS` produced non-sensical outcome, e.g., "-DpgiFortran/udunits" --> now, guessing the path for udunits2 include headers only considers an include path, and the first if multiple, from `NC_CFLAGS`
Current capabilities include: library for STEPWAT2; library for rSOILWAT2; netCDF-c; udunits2; text
- print message if text-based or nc-based SOILWAT2 fails - print information on which of the text-based, nc-based, and rSOILWAT2 runs produced output (and which didn't) - update README to illustrate how to pass environmental variable to make when running this script
dschlaep
commented
Jul 10, 2024
N1ckP3rsl3y
previously approved these changes
Jul 10, 2024
Improve tools for nc-based SOILWAT2 - Fix makefile for user provided flags for netcdf-c, udunits2, and expat - sw_print_version() now prints capabilities - Improve tools/check_outputModes.sh: information on which of the output modes succeeded and which ones failed
N1ckP3rsl3y
previously approved these changes
Jul 11, 2024
N1ckP3rsl3y
approved these changes
Jul 15, 2024
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.
This PR is phase 0 of a multi-phase plan with the objectives of increasing our capabilities to carry out large simulation experiments, see https://github.com/DrylandEcology/SOILWAT2/milestone/16
Phase 0 includes the introduction of a simulation domain (a set of simulation units/runs) and the capability to produce output as netCDFs.
Later phases will add netCDFs as inputs and parallelization across the simulation domain.
Domain/netCDF
SOILWAT2 as library for STEPWAT2 and rSOILWAT2
Other improvements
strict-prototypes
warnings #353