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

ERROR: Cannot open file Input/carbon.in: No such file or directory #74

Closed
dschlaep opened this issue Nov 16, 2017 · 5 comments
Closed

Comments

@dschlaep
Copy link
Member

  • devtools::run_examples(): all example for sw_exec with input data from files fail with error

ERROR: Cannot open file Input/carbon.in: No such file or directory

This is despite that the file Input/carbon.in is present:

list.files(path_demo, pattern = "carbon", recursive = TRUE)

[1] "Input/carbon.in"

The same error is reproduced by running any of the examples by hand:

path_demo <- system.file("extdata", "example1", package = "rSOILWAT2")
sw_in2 <- sw_inputDataFromFiles(dir = path_demo, files.in = "files_v31.in")
sw_out2 <- sw_exec(inputData = sw_in2)

Exit.. ERROR: Cannot open file Input/carbon.in: No such file or directory
Error in sw_exec(inputData = sw_in2) : @ generic.c LogError

  • devtools::test() unit tests fail with same error
@Zachary-Kramer
Copy link
Contributor

Zachary-Kramer commented Nov 16, 2017

Since adding the CSV lookup, rSOILWAT2 does not open carbon.in, only SOILWAT2 standalone does. Even if you request to use files, rSOILWAT2 will pass the swCarbon class. So, without taking a look at this right now, I'm assuming something is out of date. I can take a look later.

This error traditionally occurred when you did not provide sw_exec with the input directory. I fixed that for a couple months, and have since removed it because carbon.in is not used by rSOILWAT2 anymore.

@dschlaep
Copy link
Member Author

As above

path_demo <- system.file("extdata", "example1", package = "rSOILWAT2")
sw_in2 <- sw_inputDataFromFiles(dir = path_demo, files.in = "files_v31.in")
sw_out2 <- sw_exec(inputData = sw_in2)

All the data should be contained in variable sw_in2 including the CO2 data -- all data should be read in from files by the call sw_inputDataFromFiles(dir = path_demo, files.in = "files_v31.in") -- this does not fail.

No code, that is executed as a result of the call sw_exec(inputData = sw_in2), should attempt to read the file Input/carbon.in -- yet, something behaves otherwise and fails.

@Zachary-Kramer
Copy link
Contributor

No code, that is executed as a result of the call sw_exec(inputData = sw_in2), should attempt to read the file Input/carbon.in -- yet, something behaves otherwise and fails.

There is only one culprit I can think of. There is one function that behaves differently depending on whether or not RSOILWAT is defined. If it is defined, it uses swCarbon. If it is not defined, it uses carbon.in. Is there a possibility that these tests are not defining RSOILWAT?

I can test this tomorrow, but if you know off of the top of your head then that'd be quicker

@dschlaep
Copy link
Member Author

RSOILWAT is defined when the package is compiled and installed.

I experience the above errors during run-time as user of the package; the same goes for the tests -- they are run on a (virtual version of the) compiled/installed package.

Thus, I have a hard time seeing how this compiler flag would cause these issues during execution.

@Zachary-Kramer
Copy link
Contributor

The failures could technically be fixed with the approach in issue #50, but that would only circumvent the issue. I removed this fix recently which is likely what caused these failures, but this shouldn't have caused failures because rSOILWAT2 never reads carbon.in.

Currently, only SOILWAT2 has access to the function that reads carbon.in, so I will have to give rSOILWAT2 access to it. Ultimately, I didn't know that sw_inputDataFromFiles was required to read all input files; I thought the CSV lookup was sufficient.

What is inexplicable, though, is that carbon.in can only be read if RSOILWAT is not defined. There is no other way. There is only one function that touches the file, and it has #ifndef RSOILWAT wrapping it. I hope I'm missing something here, because it just doesn't make sense.

I experience the above errors during run-time as user of the package

Do you experience this only when testing it or in normal runs as well?

@dschlaep dschlaep self-assigned this Nov 18, 2017
dschlaep added a commit that referenced this issue Nov 18, 2017
- all unit tests pass except 3 in scope "rSOILWAT2 annual aggregation"
    --> close #42, close #74, close #75, close #76, close #77
- the unit test errors are because the values of the output slot
"CO2EFFECTS" are not calculated with aggregation function that is
specified --> see new issue #78
N1ckP3rsl3y pushed a commit that referenced this issue Jun 11, 2022
- addressing #74 (Include detailed user manual in doxygen documentation)
- close #75 (Include detailed installation instructions in doxygen documentation)

- subpages for inputs and outputs are currently only place holders
N1ckP3rsl3y pushed a commit that referenced this issue Jun 11, 2022
This version addressed documentation and unit testing:

User visible changes:
- Create and open documentation and user manual with `make doc doc_open`

Details:
- Documentation:
  - 'User manual' for SOILWAT2 provided as part of doxygen documentation (close #217, close #74)
  - Detailed installation instructions included in doxygen documentation (close #75)
  - Code contributor manual as part of doxygen documentation (close 86)
  - Doxygen warnings fixed (close #266)
  - Input units of biomass documented (close #265)

- Unit tests:
  - Contributed to the documentation and unit testing for all SOILWAT2 functions (see #216, see #219, see #76; close #73)
  - Unit tests for functions in `SW_Flow_lib.c` (close #117; contributed to #19)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants