noaa-ocs-modeling / CoupledModelDriver

coupled model configuration generation
https://CoupledModelDriver.readthedocs.io
Creative Commons Zero v1.0 Universal
4 stars 3 forks source link

Invalid path is used when trying to find mesh #158

Open SorooshMani-NOAA opened 1 year ago

SorooshMani-NOAA commented 1 year ago

Issue reported by @FariborzDaneshvar-NOAA

The input path to SCHISM configuration is correct, but then during generation this issues shows up.

generate_schism_configuration(**{
    'configuration_directory': workdir,
    'output_directory': workdir,
    'relative_paths': True,
    'overwrite': True,
    'parallel': True
})

results in

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[10], line 2
      1 # Now generate the setup (it generates SCHISM input files: [bctides.in](http://bctides.in/), Makefile, ...)
----> 2 generate_schism_configuration(**{
      3     'configuration_directory': workdir,
      4     'output_directory': workdir,
      5     'relative_paths': True,
      6     'overwrite': True,
      7     'parallel': True
      8 })

File ~/miniconda3/envs/perturbation/lib/python3.10/site-packages/coupledmodeldriver/generate/schism/generate.py:116, in generate_schism_configuration(configuration_directory, output_directory, relative_paths, overwrite, parallel)
    113 use_original_mesh = base_configuration['schism']['use_original_mesh']
    115 if original_hgrid_filename is None or not original_hgrid_filename.exists():
--> 116     raise FileNotFoundError(f'horizontal grid not found at "{original_hgrid_filename}"')
    118 local_fgrid_filename = output_directory / [original_fgrid_filename.name](http://original_fgrid_filename.name/)
    119 local_hgrid_filename = output_directory / 'hgrid.gr3'

FileNotFoundError: horizontal grid not found at "/contrib/contrib/Soroosh.Mani/demo/perturb/hgrid.grd"
SorooshMani-NOAA commented 1 year ago

It seems that absolute to relative path conversion and what current directory is have something to do with this error.

This the content of configure_schism.json file:

...
schism_executable_path:"pschism-TVD_VL"
schism_hotstart_combiner_path:"combine_hotstart7"
schism_schout_combiner_path:"combine_output11"
modeled_start_time:"2018-09-09 00:00:00"
modeled_end_time:"2018-09-18 00:00:00"
modeled_timestep:150
fgrid_path:"../../../../../../contrib/Soroosh.Mani/demo/perturb/manning.gr3"
hgrid_path:"../../../../../../contrib/Soroosh.Mani/demo/perturb/hgrid.grd"
schism_use_old_io:false
tidal_spinup_duration:172800
tidal_spinup_timestep:150
source_filename:null
use_original_mesh:false
output_surface:true
surface_output_interval:3600
output_stations:false
stations_file_path:null
stations_output_interval:360
output_spinup:true
output_elevations:true
processors:11
nems_parameters:{}
...