biopsichas / cliwf

Climate workflow
1 stars 0 forks source link

error running write.exe: missing t1.soilout #2

Closed echiaradia closed 8 months ago

echiaradia commented 8 months ago

Hi @biopsichas, running the exe_copy_run("lib", tmp_setup_path, "write.exe") command I received the following error:

[Traceback (most recent call last):
  File "peewee.py", line 3237, in execute_sql
sqlite3.OperationalError: no such column: t1.soilout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "write.py", line 8, in <module>
  File "write.py", line 6, in write_txtinout
  File "actions\write_files.py", line 60, in write
  File "actions\write_files.py", line 205, in write_simulation
  File "fileio\simulation.py", line 99, in write
  File "peewee.py", line 1962, in inner
  File "peewee.py", line 2221, in first
  File "peewee.py", line 1962, in inner
  File "peewee.py", line 2212, in peek
  File "peewee.py", line 1962, in inner
  File "peewee.py", line 2033, in execute
  File "peewee.py", line 2206, in _execute
  File "peewee.py", line 3250, in execute
  File "peewee.py", line 3234, in execute_sql
  File "peewee.py", line 3010, in __exit__
  File "peewee.py", line 192, in reraise
  File "peewee.py", line 3237, in execute_sql
peewee.OperationalError: no such column: t1.soilout
[13920] Failed to execute script 'write' due to unhandled exception!
{"percent": 0, "message": "Writing time.sim..."}
{"percent": 0, "message": "Writing print.prt..."}](url)

My sqlite file comes from the buildr script and it is compatible with the SWAT+Editor version 2.1.4. Is this a known issue? Any possibilities to fix it, perhaps by directly copying the already exported files (i.e. txtinout folder)? Many thanks enrico

biopsichas commented 8 months ago

Hi Enrico,

I think is this setup just after buildR there is one thing missing. One small dot :) It is from here. Please let me know, if it worked. I will add this into the workflow.

------------------------------------------------------------------------------

4) Adding small modification to model setup .sqlite

------------------------------------------------------------------------------

This is needed for write.exe to work (writing a dot in project_config table)

db <- dbConnect(RSQLite::SQLite(), db_path) project_config <- dbReadTable(db, 'project_config') project_config$input_files_dir <- "." dbWriteTable(db, 'project_config', project_config, overwrite = TRUE) dbDisconnect(db)

echiaradia commented 8 months ago

Thanks @biopsichas for the quick reply! I implemented the correction but the issue is not resolved. I suspect that the write.exe expects a different version of the db from mine (2.1.4) with some specific fields. I resolved the abovementioned issue editing the print_prt table in the db (adding a new field soilout) but after some steps, it returns other errors related to missing fields.... Can I skip the step using directly the files exported by the SWAT+editor?

EDIT: also tested with the sqlite copatible with SWAT+Editor v2.3.1, same errors ...

biopsichas commented 8 months ago

I think mine is also 2.1.4. So not sure why fields would be different as we used the same buildR . Would be great, if could test it with my .sqlite database. Just to know. It is here.

But of course you can skip this step and use SWATeditor. It is needed just to write fresh text management files, which farmR uses. It is not important, how you get them. This was here just to avoid manual work.

echiaradia commented 8 months ago

Yes, your sqlite works fine! I will proceed skipping the step and using the txtinout files directly. many thanks enrico