dschwilk / farsite

A fire growth model
Other
2 stars 1 forks source link

Relative paths in input files #2

Open dschwilk opened 1 year ago

dschwilk commented 1 year ago

The current code will accept relative paths in the "command" file such as runPanther.txt, and in the input input files such as cougarCreek.input. However, those paths are relative to the working directory which is where the executable was called from. For portability of data, it would be preferable for any paths in input files or atm files to be able to be relative to the containing file.

dschwilk commented 1 year ago

This requires fixes in three main areas:

  1. This should be easy to fix for the command file, because that is read and handled in the high level code called by main().

  2. The inputs file is read by ICF::Input() called by ICF::InputFarsite called by Farsite5::LoadInputsFile(). I think the correct absolute path names should be calculated here for those files in the inputs file.

  3. The atm files used for gridded wind inputs, can also be filled with paths and I would think those should be relative to the atm file so that folders could be moved around. That will require messing with CWindGrids::Create() and CWindGrids::ParseFileNamesFromAtmRec. It should be possible to deal with #7 at that time as well by producing a more informative error when the atm file is read.

Step 2, above, is likely to be the most complicated because of the low-level way that the file reading code handles this (Eg swapping file pointers around to change from reading directly embedded RAWS wx data to reading a separate RAWS file as on icf_input.cpp line 873.