diff --git a/build/includes/job_actor/job_actor_subroutine_wrappers.hpp b/build/includes/job_actor/job_actor_subroutine_wrappers.hpp index 0a0dd1d72c937a707215771a8a4377e06f484d95..a0073c98cc95008f485b335dc29da20b543d11d5 100644 --- a/build/includes/job_actor/job_actor_subroutine_wrappers.hpp +++ b/build/includes/job_actor/job_actor_subroutine_wrappers.hpp @@ -7,12 +7,6 @@ extern "C" { int* num_hru, int* err); - void readDimension(int* num_gru, int* num_hru, int* start_gru_index, int* err); - - void readIcondNLayers(int* num_gru, int* err); - - void allocateTimeStructure(int* err); - void deallocateJobActor(int* err); } \ No newline at end of file diff --git a/build/source/actors/hru_actor/fortran_code/hru_restart.f90 b/build/source/actors/hru_actor/fortran_code/hru_restart.f90 index c7ea33740a92eee470cd836ecf758c7b93f8fa0a..ab487caaa673df5bfad133cc72204a2c96f4afaa 100644 --- a/build/source/actors/hru_actor/fortran_code/hru_restart.f90 +++ b/build/source/actors/hru_actor/fortran_code/hru_restart.f90 @@ -69,7 +69,7 @@ subroutine summa_readRestart(& USE nrtype ! variable types, etc. ! functions and subroutines USE time_utils_module,only:elapsedSec ! calculate the elapsed time - USE read_icond_gru_hru_module,only:read_icond ! module to read initial conditions + USE read_icond_actors_module,only:read_icond ! module to read initial conditions USE check_icond4chm_module,only:check_icond4chm ! module to check initial conditions USE var_derive_module,only:calcHeight ! module to calculate height at layer interfaces and layer mid-point USE var_derive_module,only:v_shortcut ! module to calculate "short-cut" variables diff --git a/build/source/actors/job_actor/job_actor.cpp b/build/source/actors/job_actor/job_actor.cpp index 504491cc1553d1b0bfbc17c54ca71768be771f2c..558f53fa7d2fbb8008c6d54237d208521f6e8f83 100644 --- a/build/source/actors/job_actor/job_actor.cpp +++ b/build/source/actors/job_actor/job_actor.cpp @@ -61,20 +61,21 @@ behavior job_actor(stateful_actor<job_state>* self, // Initalize global variables calling Fortran Routines int err = 0; + + /* + Calls: + - summa_SetTimesDirsAndFiles() + - summa_defineGlobalData() + - read_icond_nlayers() + - Allocates time structures + */ job_init_fortran(self->state.job_actor_settings.file_manager_path.c_str(), &self->state.start_gru, &self->state.num_gru, &self->state.num_hru, &err); - - readDimension(&self->state.num_gru, &self->state.num_hru, &self->state.start_gru, &err); - if (err != 0) { aout(self) << "\nERROR: Job_Actor - readDimension\n"; return {}; } - - readIcondNLayers(&self->state.num_gru, &err); - if (err != 0) { aout(self) << "\nERROR: Job_Actor - readIcondNLayers\n"; return {};} + if (err != 0) { aout(self) << "\nERROR: Job_Actor - job_init_fortran\n"; return {}; } - allocateTimeStructure(&err); - if (err != 0) { aout(self) << "\nERROR: Job_Actor - allocateTimeStructure\n"; return {}; } // Spawn the file_access_actor. This will return the number of forcing files we are working with self->state.file_access_actor = self->spawn(file_access_actor, diff --git a/build/source/actors/job_actor/job_actor.f90 b/build/source/actors/job_actor/job_actor.f90 index dc0b0cc080a7eaa4c2784cdd5bb3f215a750b0ec..e335c7c9e7cf0bfe3316f741723f89944533be2a 100644 --- a/build/source/actors/job_actor/job_actor.f90 +++ b/build/source/actors/job_actor/job_actor.f90 @@ -1,36 +1,64 @@ module job_actor USE, intrinsic :: iso_c_binding + + ! global data + USE globalData,only:integerMissing ! missing integer value + USE globalData,only:realMissing ! missing double precision value implicit none public::job_init_fortran - public::allocateTimeStructure public::deallocateJobActor contains subroutine job_init_fortran(file_manager, start_gru, num_gru,& num_hru, err) bind(C, name="job_init_fortran") + USE nrtype ! variable types, etc. + USE summaFileManager,only:summa_SetTimesDirsAndFiles ! sets directories and filenames USE summa_globalData,only:summa_defineGlobalData ! used to define global summa data structures USE cppwrap_auxiliary,only:c_f_string ! Convert C String to Fortran String + ! provide access to file paths + USE summaFileManager,only:SETTINGS_PATH ! define path to settings files (e.g., parameters, soil and veg. tables) + USE summaFileManager,only:STATE_PATH ! optional path to state/init. condition files (defaults to SETTINGS_PATH) + USE summaFileManager,only:MODEL_INITCOND ! name of model initial conditions file + USE summaFileManager,only:LOCAL_ATTRIBUTES ! name of model initial attributes file + + ! subroutines and functions: read dimensions (NOTE: NetCDF) + USE read_attrb_actors_module,only:read_dimension ! module to read dimensions of GRU and HRU + USE read_icond_actors_module,only:read_icond_nlayers ! module to read initial condition dimensions + + USE globalData,only:indx_meta ! metadata structures + USE globalData,only:startTime,finshTime,refTime,oldTime + USE allocspace_module,only:allocLocal + USE globalData,only:time_meta + ! Variables that were set by getCommandArguments() USE globalData,only: startGRU ! index of the starting GRU for parallelization run - + USE globalData,only: checkHRU ! index of the HRU for a single HRU run + USE globalData,only: iRunMode ! define the current running mode + USE globalData,only:iRunModeFull, iRunModeGRU, iRunModeHRU ! define the running modes implicit none ! dummy variables character(kind=c_char,len=1),intent(in) :: file_manager integer(c_int),intent(in) :: start_gru - integer(c_int),intent(in) :: num_gru - integer(c_int),intent(in) :: num_hru + integer(c_int),intent(inout) :: num_gru + integer(c_int),intent(inout) :: num_hru integer(c_int),intent(out) :: err ! local variables character(len=256) :: summaFileManagerIn + character(len=256) :: restartFile ! restart file name + character(len=256) :: attrFile ! attributes file name + integer(i4b) :: fileGRU ! [used for filenames] number of GRUs in the input file + integer(i4b) :: fileHRU ! [used for filenames] number of HRUs in the input file + + character(len=256) :: message ! Convert C Variables to Fortran Variables @@ -40,33 +68,50 @@ subroutine job_init_fortran(file_manager, start_gru, num_gru,& ! Set variables that were previosuly set by getCommandArguments() startGRU=start_gru + iRunMode=iRunModeFull + checkHRU=integerMissing call summa_SetTimesDirsAndFiles(summaFileManagerIn,err,message) - if(err/=0)then; print*, message; return; endif + if(err/=0)then; print*, trim(message); return; endif call summa_defineGlobalData(err, message) - if(err/=0)then; print*, message; return; endif + if(err/=0)then; print*, trim(message); return; endif + + ! ***************************************************************************** + ! *** read the number of GRUs and HRUs + ! ***************************************************************************** + ! obtain the HRU and GRU dimensions in the LocalAttribute file + attrFile = trim(SETTINGS_PATH)//trim(LOCAL_ATTRIBUTES) + select case (iRunMode) + case(iRunModeFull); call read_dimension(attrFile,num_gru,num_hru,start_gru,err) + case(iRunModeGRU ); err=20; message='iRunModeGRU not implemented for Actors Code' + case(iRunModeHRU ); err=20; message='iRunModeHRU not implemented for Actors Code' + end select + if(err/=0)then; print*, trim(message); return; endif + + ! ***************************************************************************** + ! *** read the number of snow and soil layers + ! ***************************************************************************** + ! set restart filename and read the number of snow and soil layers from the initial conditions (restart) file + if(STATE_PATH == '') then + restartFile = trim(SETTINGS_PATH)//trim(MODEL_INITCOND) + else + restartFile = trim(STATE_PATH)//trim(MODEL_INITCOND) + endif + call read_icond_nlayers(trim(restartFile),num_gru,indx_meta,err,message) + if(err/=0)then; print*, trim(message); return; endif + + + ! Allocate the time structures + call allocLocal(time_meta, startTime, err=err, message=message) + call allocLocal(time_meta, finshTime, err=err, message=message) + call allocLocal(time_meta, refTime, err=err, message=message) + call allocLocal(time_meta, oldTime, err=err, message=message) + if(err/=0)then; print*, trim(message); return; endif end subroutine job_init_fortran -subroutine allocateTimeStructure(err) bind(C, name="allocateTimeStructure") - USE globalData,only:startTime,finshTime,refTime,oldTime - USE allocspace_module,only:allocLocal - USE globalData,only:time_meta - - implicit none - ! dummy variables - integer(c_int),intent(inout) :: err - ! local variables - character(len=256) :: cmessage - - call allocLocal(time_meta, startTime, err=err, message=cmessage) - call allocLocal(time_meta, finshTime, err=err, message=cmessage) - call allocLocal(time_meta, refTime, err=err, message=cmessage) - call allocLocal(time_meta, oldTime, err=err, message=cmessage) -end subroutine - subroutine deallocateJobActor(err) bind(C, name="deallocateJobActor") USE globalData,only:structInfo ! information on the data structures USE globalData,only:statForc_meta ! child metadata for stats diff --git a/build/source/engine/read_attrb.f90 b/build/source/engine/read_attrb.f90 index 459484b2c9cd9952db624b0adcc89b570c55d2b8..39b1c95ee3cb51a5649f24568b8d989561ede0d2 100644 --- a/build/source/engine/read_attrb.f90 +++ b/build/source/engine/read_attrb.f90 @@ -18,19 +18,17 @@ ! You should have received a copy of the GNU General Public License ! along with this program. If not, see <http://www.gnu.org/licenses/>. -module read_attrb_module -USE, intrinsic :: iso_c_binding +module read_attrb_actors_module USE nrtype implicit none private public::read_dimension -! public::read_attribute contains ! ************************************************************************************************ ! public subroutine read_dimension: read HRU and GRU dimension information on local attributes ! ************************************************************************************************ -subroutine read_dimension(numGRUs,numHRUs,startGRU,err) bind(C, name="readDimension") +subroutine read_dimension(attrFile,numGRUs,numHRUs,startGRU,err) USE netcdf USE netcdf_util_module,only:nc_file_open ! open netcdf file @@ -39,22 +37,18 @@ subroutine read_dimension(numGRUs,numHRUs,startGRU,err) bind(C, name="readDimens ! provide access to global data USE globalData,only:gru_struc ! gru->hru mapping structure USE globalData,only:index_map ! hru->gru mapping structure - ! file paths for attribute file - USE summaFileManager,only:SETTINGS_PATH ! define path to settings files (e.g., parameters, soil and veg. tables) - USE summaFileManager,only:LOCAL_ATTRIBUTES ! name of model initial attributes file implicit none ! Dummy Variables - - integer(c_int),intent(in) :: numGRUs ! number of GRUs for the run domain - integer(c_int),intent(out) :: numHRUs ! number of HRUs for the run domain (value filled in this subroutine) - integer(c_int),intent(in) :: startGRU ! Index of the starting GRU - integer(c_int),intent(out) :: err ! error code + character(*),intent(in) :: attrFile ! name of attributed file + integer(i4b),intent(in) :: numGRUs ! number of GRUs for the run domain + integer(i4b),intent(out) :: numHRUs ! number of HRUs for the run domain (value filled in this subroutine) + integer(i4b),intent(in) :: startGRU ! Index of the starting GRU + integer(i4b),intent(out) :: err ! error code ! Local Variables - character(len=256) :: attrFile ! name of attributed file integer(i4b) :: fileGRU ! number of GRUs in the input file integer(i4b) :: fileHRU ! number of HRUs in the input file integer(i4b) :: iHRU ! HRU couinting index @@ -73,7 +67,6 @@ subroutine read_dimension(numGRUs,numHRUs,startGRU,err) bind(C, name="readDimens character(len=256) :: cmessage ! error message for downwind routine err=0; message="read_dimension/" - attrFile = trim(SETTINGS_PATH)//trim(LOCAL_ATTRIBUTES) ! open nc file call nc_file_open(trim(attrFile),nf90_noWrite,ncID,err,cmessage) @@ -224,4 +217,4 @@ subroutine read_dimension(numGRUs,numHRUs,startGRU,err) bind(C, name="readDimens end subroutine read_dimension -end module read_attrb_module +end module read_attrb_actors_module diff --git a/build/source/hookup/summaFileManager.f90 b/build/source/hookup/summaFileManager.f90 deleted file mode 100755 index 161e8496a1cd77750b0d057fdff936e21647ffb9..0000000000000000000000000000000000000000 --- a/build/source/hookup/summaFileManager.f90 +++ /dev/null @@ -1,183 +0,0 @@ -! SUMMA - Structure for Unifying Multiple Modeling Alternatives -! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington -! -! This file is part of SUMMA -! -! For more information see: http://www.ral.ucar.edu/projects/summa -! -! This program is free software: you can redistribute it and/or modify -! it under the terms of the GNU General Public License as published by -! the Free Software Foundation, either version 3 of the License, or -! (at your option) any later version. -! -! This program is distributed in the hope that it will be useful, -! but WITHOUT ANY WARRANTY; without even the implied warranty of -! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -! GNU General Public License for more details. -! -! You should have received a copy of the GNU General Public License -! along with this program. If not, see <http://www.gnu.org/licenses/>. - -!****************************************************************** -! Original version based on: -! (C) Copyright 2009-2010 --- Dmitri Kavetski and Martyn Clark --- All rights reserved -!****************************************************************** -MODULE summaFileManager - USE, intrinsic :: iso_c_binding - use nrtype - implicit none - public - ! summa-wide pathlength - integer(i4b),parameter :: summaPathLen=4096 - ! defines the time of the run - CHARACTER(LEN=summaPathLen) :: CONTROL_VRS = 'SUMMA_FILE_MANAGER_V3.0.0' ! control version - CHARACTER(LEN=summaPathLen) :: SIM_START_TM = '2000-01-01 00:00' ! simulation start time - CHARACTER(LEN=summaPathLen) :: SIM_END_TM = '2000-01-01 00:00' ! simulation end time - CHARACTER(LEN=summaPathLen) :: NC_TIME_ZONE = 'utcTime' ! time zone info - ! defines the path for data files (and default values) - CHARACTER(LEN=summaPathLen) :: SETTINGS_PATH = 'settings/' ! settings dir path - CHARACTER(LEN=summaPathLen) :: STATE_PATH = '' ! state file / init. cond. dir path (if omitted, defaults - ! to SETTINGS_PATH for input, OUTPATH for output) - CHARACTER(LEN=summaPathLen) :: FORCING_PATH = 'forcing/default/' ! input_dir_path - CHARACTER(LEN=summaPathLen) :: OUTPUT_PATH = 'output/default/' ! output_dir_path - ! define name of control files (and default values) - CHARACTER(LEN=summaPathLen) :: M_DECISIONS = 'summa_zDecisions.txt' ! definition of model decisions - CHARACTER(LEN=summaPathLen) :: OUTPUT_CONTROL = 'summa_zLocalModelVarMeta.txt' ! metadata for model variables - CHARACTER(LEN=summaPathLen) :: LOCAL_ATTRIBUTES = 'summa_zLocalAttributes.txt' ! local attributes - CHARACTER(LEN=summaPathLen) :: LOCALPARAM_INFO = 'summa_zLocalParamInfo.txt' ! default values and constraints for local model parameters - CHARACTER(LEN=summaPathLen) :: BASINPARAM_INFO = 'summa_zBasinParamInfo.txt' ! default values and constraints for basin model parameters - CHARACTER(LEN=summaPathLen) :: VEGPARM = 'VEGPARM.TBL' ! noah vegetation parameter table - CHARACTER(LEN=summaPathLen) :: SOILPARM = 'SOILPARM.TBL' ! noah soil parameter table - CHARACTER(LEN=summaPathLen) :: GENPARM = 'GENPARM.TBL' ! noah general parameter table - CHARACTER(LEN=summaPathLen) :: MPTABLE = 'MPTABLE.TBL' ! noah mp parameter table - CHARACTER(LEN=summaPathLen) :: FORCING_FILELIST = 'summa_zForcingFileList.txt' ! list of focing files for each HRU - CHARACTER(LEN=summaPathLen) :: MODEL_INITCOND = 'summa_zInitialCond.txt' ! model initial conditions - CHARACTER(LEN=summaPathLen) :: PARAMETER_TRIAL = 'summa_zParamTrial.txt' ! trial values for model parameters - CHARACTER(LEN=summaPathLen) :: OUTPUT_PREFIX = 'summa_output_' ! prefix for the output file - - contains - -! ************************************************************************************************** -! public subroutine summa_SetTimesDirsAndFiles: Sets times, directories and filenames for summa run -! ************************************************************************************************** -subroutine summa_SetTimesDirsAndFiles(file_manager,err) bind(C, name="setTimesDirsAndFiles") - ! Purpose: Sets run times, directories and filenames for summa. - ! --- - USE ascii_util_module,only:file_open ! function to open file - USE ascii_util_module,only:linewidth ! max character number for one line - USE ascii_util_module,only:get_vlines ! function to get a vector of non-comment lines - - USE cppwrap_auxiliary,only:c_f_string - - - implicit none - - ! input/output vars - character(kind=c_char,len=1),intent(in) :: file_manager - integer(c_int),intent(out) :: err - ! local vars - character(len=256) :: summaFileManagerIn - character(len=256) :: message - character(*),parameter :: summaFileManagerHeader='SUMMA_FILE_MANAGER_V3.0.0' - integer(i4b),parameter :: runinfo_fileunit=67 ! file unit for run time information - character(len=8) :: cdate - character(len=10) :: ctime - character(len=256) :: cmessage ! error message for downwind routine - integer(i4b) :: unt ! file unit (free unit output from file_open) - character(LEN=linewidth),allocatable :: charline(:) ! vector of character strings - integer(i4b) :: iControl, nControl ! number of model info - character(len=summaPathLen) :: varEntry ! name of model info - character(len=32) :: option ! option for model info - - err=0; message="summa_SetTimesDirsAndFiles/" - - call c_f_string(file_manager, summaFileManagerIn, 256) - summaFileManagerIn = trim(summaFileManagerIn) - - - ! read information from model control file, and populate model control structure - ! populates global control information structure - - ! open file, read non-comment lines, close file - call file_open(trim(summaFileManagerIn),unt,err,cmessage) - if(err/=0) then - message=trim(message)//trim(cmessage)//"/Failed to open control file [''"//trim(summaFileManagerIn)//"']" - print*, message - err=-10 - return - end if - call get_vlines(unt,charline,err,cmessage) ! 'charline' is a list of strings from non-comment lines - if(err/=0) then - message=trim(message)//trim(cmessage)//"/Control file read issue in get_vlines()" - print*, message - return - end if - close(unt) - - ! get the number of model control file entries - nControl = size(charline) - - ! populate the model control info structure - do iControl=1,nControl - ! extract name of decision and the decision selected - read(charline(iControl),*,iostat=err) option, varEntry - if (err/=0) then - err=30; message=trim(message)//"error reading charline array"; - print*, message - return - end if - ! get the index of the control file entry in the data structure - - ! assign entries from control file to module public variables; add checking as needed - select case(trim(option)) - case('controlVersion' ); - CONTROL_VRS = trim(varEntry); - if(trim(varEntry)/=trim(summaFileManagerHeader)) then - message=trim(message)//"unknown control file version in '"//trim(summaFileManagerIn)//" looking for "//trim(summaFileManagerHeader) - err=20 - return - end if - case('simStartTime' ); SIM_START_TM = trim(varEntry) ! start simulation time - case('simEndTime' ); SIM_END_TM = trim(varEntry) ! end simulation time - case('tmZoneInfo' ); NC_TIME_ZONE = trim(varEntry) ! time zone info - case('settingsPath' ); SETTINGS_PATH = trim(varEntry) ! settings directory - case('forcingPath' ); FORCING_PATH = trim(varEntry) ! input forcing directory - case('outputPath' ); OUTPUT_PATH = trim(varEntry) ! output directory - case('statePath' ); STATE_PATH = trim(varEntry) ! state file input/output directory - case('decisionsFile' ); M_DECISIONS = trim(varEntry) ! model decisions file - case('outputControlFile' ); OUTPUT_CONTROL = trim(varEntry) ! output control file - case('globalHruParamFile' ); LOCALPARAM_INFO = trim(varEntry) ! default/global hru-level param file - case('globalGruParamFile' ); BASINPARAM_INFO = trim(varEntry) ! default/global gru-level param file - case('attributeFile' ); LOCAL_ATTRIBUTES = trim(varEntry) ! attribute file - case('trialParamFile' ); PARAMETER_TRIAL = trim(varEntry) ! trial parameters file (hru and/or gru) - case('vegTableFile' ); VEGPARM = trim(varEntry) ! vegetation parameter table - case('soilTableFile' ); SOILPARM = trim(varEntry) ! soil parameter table - case('generalTableFile' ); GENPARM = trim(varEntry) ! general parameter table - case('noahmpTableFile' ); MPTABLE = trim(varEntry) ! noah mp parameter table - case('forcingListFile' ); FORCING_FILELIST = trim(varEntry) ! file listing forcing filenames - case('initConditionFile' ); MODEL_INITCOND = trim(varEntry) ! initial conditions file (cold State) - case('outFilePrefix' ); OUTPUT_PREFIX = trim(varEntry) ! filename root for output files - ! get to here if cannot find the variable - case default - err=10 - message=trim(message)//"unknown control file option: "//trim(option) - print*, message - return - end select - end do - - ! before embarking on a run, check that the output directory is writable; write system date and time to a log file there - open(runinfo_fileunit,file=trim(OUTPUT_PATH)//"runinfo.txt",iostat=err) - if(err/=0)then - err=10; message=trim(message)//"cannot write to output directory '"//trim(OUTPUT_PATH)//"'" - print*, message - return - end if - call date_and_time(cdate,ctime) - write(runinfo_fileunit,*) 'Run start time on system: ccyy='//cdate(1:4)//' - mm='//cdate(5:6)//' - dd='//cdate(7:8), & - ' - hh='//ctime(1:2)//' - mi='//ctime(3:4)//' - ss='//ctime(5:10) - close(runinfo_fileunit) - -end subroutine summa_SetTimesDirsAndFiles - -END MODULE summaFileManager diff --git a/build/source/netcdf/read_icond.f90 b/build/source/netcdf/read_icond.f90 index e3f3e01a8624bb56e07c9369ba7b52a024517b7a..676f20fe178831f935f83ece55bcf93cc6eb39c4 100644 --- a/build/source/netcdf/read_icond.f90 +++ b/build/source/netcdf/read_icond.f90 @@ -18,7 +18,7 @@ ! You should have received a copy of the GNU General Public License ! along with this program. If not, see <http://www.gnu.org/licenses/>. -module read_icond_gru_hru_module +module read_icond_actors_module USE, intrinsic :: iso_c_binding USE nrtype USE netcdf @@ -37,7 +37,7 @@ contains ! ************************************************************************************************ ! public subroutine read_icond_nlayers: read model initial conditions file for number of snow/soil layers ! ************************************************************************************************ -subroutine read_icond_nlayers(nGRU,err) bind(C, name="readIcondNLayers") +subroutine read_icond_nlayers(iconFile,nGRU,indx_meta,err,message) ! -------------------------------------------------------------------------------------------------------- ! modules USE nrtype @@ -48,21 +48,16 @@ subroutine read_icond_nlayers(nGRU,err) bind(C, name="readIcondNLayers") USE netcdf_util_module,only:netcdf_err ! netcdf error handling USE data_types,only:gru_hru_intVec ! actual data USE data_types,only:var_info ! metadata - - USE globalData,only:indx_meta - - ! file paths - USE summaFileManager,only:STATE_PATH ! optional path to state/init. condition files (defaults to SETTINGS_PATH) - USE summaFileManager,only:SETTINGS_PATH ! define path to settings files (e.g., parameters, soil and veg. tables) - USE summaFileManager,only:MODEL_INITCOND ! name of model initial conditions file - implicit none ! -------------------------------------------------------------------------------------------------------- ! variable declarations ! dummies - integer(c_int) ,intent(in) :: nGRU ! total # of GRUs in run domain - integer(c_int) ,intent(out) :: err ! error code + character(*) ,intent(in) :: iconFile ! name of input (restart) file + integer(i4b) ,intent(in) :: nGRU ! total # of GRUs in run domain + type(var_info) ,intent(in) :: indx_meta(:) ! metadata + integer(i4b) ,intent(out) :: err ! error code + character(*) ,intent(out) :: message ! returned error message ! locals integer(i4b) :: ncID ! netcdf file id @@ -72,12 +67,7 @@ subroutine read_icond_nlayers(nGRU,err) bind(C, name="readIcondNLayers") integer(i4b) :: iGRU, iHRU ! loop indexes integer(i4b) :: iHRU_global ! index of HRU in the netcdf file integer(i4b),allocatable :: snowData(:) ! number of snow layers in all HRUs - integer(i4b),allocatable :: soilData(:) ! number of soil layers in all HRUs - - character(len=256) :: iconFile ! restart file name - - - character(len=256) :: message ! returned error message + integer(i4b),allocatable :: soilData(:) ! number of soil layers in all HRUs character(len=256) :: cmessage ! downstream error message ! -------------------------------------------------------------------------------------------------------- @@ -85,12 +75,6 @@ subroutine read_icond_nlayers(nGRU,err) bind(C, name="readIcondNLayers") err=0 message = 'read_icond_nlayers/' - if(STATE_PATH == '') then - iconFile = trim(SETTINGS_PATH)//trim(MODEL_INITCOND) - else - iconFile = trim(STATE_PATH)//trim(MODEL_INITCOND) - endif - ! open netcdf file call nc_file_open(iconFile,nf90_nowrite,ncid,err,cmessage); if (err/=0) then; message=trim(message)//trim(cmessage); return; end if @@ -357,4 +341,4 @@ subroutine read_icond(& end subroutine read_icond -end module read_icond_gru_hru_module +end module read_icond_actors_module