From 2e246599c9683abc07cc19a0298e353de5eb596a Mon Sep 17 00:00:00 2001 From: Kyle Klenk <kyle.c.klenk@gmail.com> Date: Thu, 25 Aug 2022 20:08:48 +0000 Subject: [PATCH] fixed unused variables in new subroutines --- build/source/driver/SummaActors_setup.f90 | 10 +-------- build/source/engine/read_attribute.f90 | 21 +++++-------------- .../source/hookup/summaActors_FileManager.f90 | 2 +- build/source/netcdf/read_icondActors.f90 | 4 ++-- build/source/netcdf/writeOutput.f90 | 11 ++-------- 5 files changed, 11 insertions(+), 37 deletions(-) diff --git a/build/source/driver/SummaActors_setup.f90 b/build/source/driver/SummaActors_setup.f90 index 03a5d91..8b268e5 100755 --- a/build/source/driver/SummaActors_setup.f90 +++ b/build/source/driver/SummaActors_setup.f90 @@ -114,9 +114,6 @@ contains ! timing variables USE globalData,only:startSetup,endSetup ! date/time for the start and end of the parameter setup USE globalData,only:elapsedSetup ! elapsed time for the parameter setup - ! file paths - USE summaActors_FileManager,only:SETTINGS_PATH ! define path to settings files (e.g., parameters, soil and veg. tables) - USE summaActors_FileManager,only:LOCAL_ATTRIBUTES ! name of model initial attributes file ! Noah-MP parameters USE NOAHMP_VEG_PARAMETERS,only:SAIM,LAIM ! 2-d tables for stem area index and leaf area index (vegType,month) USE NOAHMP_VEG_PARAMETERS,only:HVT,HVB ! height at the top and bottom of vegetation (vegType) @@ -155,7 +152,6 @@ contains type(var_i),pointer :: oldTime ! time for the previous model time step character(len=256) :: message ! error message character(len=256) :: cmessage ! error message of downwind routine - character(len=256) :: attrFile ! attributes file name integer(i4b) :: iVar ! looping variables ! --------------------------------------------------------------------------------------- ! initialize error control @@ -174,8 +170,6 @@ contains call c_f_pointer(handle_startTime, startTime) call c_f_pointer(handle_oldTime, oldTime) - - ! ffile_info and mDecisions moved to their own seperate subroutine call !numTimeSteps = numtim @@ -195,11 +189,9 @@ contains ! *** read local attributes for each HRU ! ***************************************************************************** - ! define the attributes file - attrFile = trim(SETTINGS_PATH)//trim(LOCAL_ATTRIBUTES) ! read local attributes for each HRU - call read_attribute(indxHRU,indxGRU,trim(attrFile),attrStruct,typeStruct,idStruct,err,cmessage) + call read_attribute(indxHRU,indxGRU,attrStruct,typeStruct,idStruct,err,cmessage) if(err/=0)then; message=trim(message)//trim(cmessage); return; endif ! ***************************************************************************** diff --git a/build/source/engine/read_attribute.f90 b/build/source/engine/read_attribute.f90 index 93b935d..cb5f3d5 100644 --- a/build/source/engine/read_attribute.f90 +++ b/build/source/engine/read_attribute.f90 @@ -48,10 +48,10 @@ subroutine read_dimension(numGRUs,numHRUs,startGRU,err) bind(C, name="readDimens ! Dummy Variables - 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 + 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 ! Local Variables character(len=256) :: attrFile ! name of attributed file @@ -159,7 +159,7 @@ subroutine read_dimension(numGRUs,numHRUs,startGRU,err) bind(C, name="readDimens end subroutine read_dimension -subroutine read_attribute(indxHRU, indxGRU, attrFile, attrStruct, typeStruct, idStruct, err, message) +subroutine read_attribute(indxHRU, indxGRU, attrStruct, typeStruct, idStruct, err, message) USE netcdf USE netcdf_util_module,only:nc_file_open ! open netcdf file USE netcdf_util_module,only:nc_file_close ! close netcdf file @@ -169,7 +169,6 @@ subroutine read_attribute(indxHRU, indxGRU, attrFile, attrStruct, typeStruct, id USE data_types,only:var_i ! x%var(:) integer(8) USE data_types,only:var_i8 ! x%var(:) (dp) ! provide access to global data - USE globalData,only:gru_struc ! gru-hru mapping structure USE globalData,only:attr_meta,type_meta,id_meta ! metadata structures USE get_ixname_module,only:get_ixAttr,get_ixType,get_ixId ! access function to find index of elements in structure ! get the settings from the output stucture so we do not have to go to file @@ -179,7 +178,6 @@ subroutine read_attribute(indxHRU, indxGRU, attrFile, attrStruct, typeStruct, id integer(i4b),intent(in) :: indxHRU ! id of the HRU integer(i4b),intent(in) :: indxGRU ! id of the parent GRU ! io vars - character(*) :: attrFile ! input filename type(var_d),intent(inout) :: attrStruct ! local attributes for each HRU type(var_i),intent(inout) :: typeStruct ! local classification of soil veg etc. for each HRU type(var_i8),intent(inout) :: idStruct ! @@ -187,10 +185,7 @@ subroutine read_attribute(indxHRU, indxGRU, attrFile, attrStruct, typeStruct, id character(*),intent(out) :: message ! error message ! define local variables - character(len=256) :: cmessage ! error message for downwind routine integer(i4b) :: iVar ! loop through varibles in the netcdf file - integer(i4b) :: varType ! type of variable (categorica, numerical, idrelated) - integer(i4b) :: varIndx ! index of variable within its data structure ! check structures integer(i4b) :: iCheck ! index of an attribute name @@ -199,15 +194,9 @@ subroutine read_attribute(indxHRU, indxGRU, attrFile, attrStruct, typeStruct, id logical(lgt),allocatable :: checkAttr(:) ! vector to check if we have all desired local attributes ! netcdf variables - integer(i4b) :: ncID ! netcdf file id - character(LEN=nf90_max_name) :: varName ! character array of netcdf variable name - integer(i4b) :: nVar ! number of variables in netcdf local attribute file integer(i4b),parameter :: categorical=101 ! named variable to denote categorical data integer(i4b),parameter :: numerical=102 ! named variable to denote numerical data integer(i4b),parameter :: idrelated=103 ! named variable to denote ID related data - integer(i4b) :: categorical_var(1) ! temporary categorical variable from local attributes netcdf file - real(dp) :: numeric_var(1) ! temporary numeric variable from local attributes netcdf file - integer(8) :: idrelated_var(1) ! temporary ID related variable from local attributes netcdf file ! define mapping variables diff --git a/build/source/hookup/summaActors_FileManager.f90 b/build/source/hookup/summaActors_FileManager.f90 index f21f476..07d202e 100755 --- a/build/source/hookup/summaActors_FileManager.f90 +++ b/build/source/hookup/summaActors_FileManager.f90 @@ -76,7 +76,7 @@ subroutine summa_SetTimesDirsAndFiles(file_manager,err) bind(C, name="setTimesDi ! input/output vars character(kind=c_char,len=1),intent(in) :: file_manager - integer(i4b),intent(out) :: err + integer(c_int),intent(out) :: err ! local vars character(len=256) :: summaFileManagerIn character(len=256) :: message diff --git a/build/source/netcdf/read_icondActors.f90 b/build/source/netcdf/read_icondActors.f90 index 9dec43a..52bf5a1 100644 --- a/build/source/netcdf/read_icondActors.f90 +++ b/build/source/netcdf/read_icondActors.f90 @@ -61,8 +61,8 @@ subroutine read_icond_nlayers(nGRU,err) bind(C, name="readIcondNLayers") ! -------------------------------------------------------------------------------------------------------- ! variable declarations ! dummies - integer(i4b) ,intent(in) :: nGRU ! total # of GRUs in run domain - integer(i4b) ,intent(out) :: err ! error code + integer(c_int) ,intent(in) :: nGRU ! total # of GRUs in run domain + integer(c_int) ,intent(out) :: err ! error code ! locals integer(i4b) :: ncID ! netcdf file id diff --git a/build/source/netcdf/writeOutput.f90 b/build/source/netcdf/writeOutput.f90 index 3b7ce49..5eb8af2 100644 --- a/build/source/netcdf/writeOutput.f90 +++ b/build/source/netcdf/writeOutput.f90 @@ -247,7 +247,7 @@ subroutine writeData(ncid,outputTimestep,outputTimestepUpdate,maxLayers,nSteps, if(meta(iVar)%varType==iLookVarType%scalarv) then call writeScalar(ncid, outputTimeStep, outputTimeStepUpdate, nSteps, minGRU, maxGRU, numGRU, iFreq, iVar, meta, stat, map, err, message) else ! non-scalar variables: regular data structures - call writeVector(ncid, outputTimeStep, outputTimeStepUpdate, maxLayers, nSteps, minGRU, maxGRU, numGRU, iFreq, iVar, meta, dat, & + call writeVector(ncid, outputTimeStep, maxLayers, nSteps, minGRU, maxGRU, numGRU, iFreq, iVar, meta, dat, & indx, err, message) end if ! not scalarv @@ -317,7 +317,7 @@ subroutine writeScalar(ncid, outputTimestep, outputTimestepUpdate, nSteps, minGR end subroutine -subroutine writeVector(ncid, outputTimestep, outputTimestepUpdate, maxLayers, nSteps, minGRU, maxGRU, & +subroutine writeVector(ncid, outputTimestep, maxLayers, nSteps, minGRU, maxGRU, & numGRU, iFreq, iVar, meta, dat, indx, err, message) USE data_types,only:var_info ! metadata type USE var_lookup,only:iLookIndex ! index into index structure @@ -326,7 +326,6 @@ subroutine writeVector(ncid, outputTimestep, outputTimestepUpdate, maxLayers, nS implicit none type(var_i) ,intent(in) :: ncid ! fileid integer(i4b) ,intent(inout) :: outputTimestep(:) ! output time step - integer(i4b) ,intent(inout) :: outputTimestepUpdate(:) ! number of HRUs in the run domain integer(i4b) ,intent(in) :: maxLayers ! maximum number of layers integer(i4b) ,intent(in) :: nSteps ! number of timeSteps integer(i4b) ,intent(in) :: minGRU ! minGRU index to write @@ -434,12 +433,6 @@ subroutine writeVector(ncid, outputTimestep, outputTimestepUpdate, maxLayers, nS end select ! data type stepCounter = stepCounter + 1 end do ! iStep - ! if (outputTimeStepUpdate(iFreq) /= stepCounter ) then - ! print*, "ERROR Missmatch in Steps: for non scalar case" - ! print*, " outputTimeStepUpdate(iFreq) = ", outputTimeStepUpdate(iFreq) - ! print*, " stepCounter = ", stepCounter - ! return - ! endif end subroutine ! ************************************************************************************** -- GitLab