Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Summa Actors
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Numerical_Simulations_Lab
Actors
Summa Actors
Commits
537e7023
Commit
537e7023
authored
2 years ago
by
Kyle
Browse files
Options
Downloads
Patches
Plain Diff
got new function for calulating statistics compiled
parent
bb5993d4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
build/source/actors/hru_actor/hru_actor.f90
+123
-31
123 additions, 31 deletions
build/source/actors/hru_actor/hru_actor.f90
build/source/driver/summaActors_wOutputStruc.f90
+0
-2
0 additions, 2 deletions
build/source/driver/summaActors_wOutputStruc.f90
with
123 additions
and
33 deletions
build/source/actors/hru_actor/hru_actor.f90
+
123
−
31
View file @
537e7023
module
hru_actor
USE
,
intrinsic
::
iso_c_binding
USE
nrtype
USE
data_types
,
only
:&
var_i
,
&
var_i8
,
&
var_d
,
&
var_ilength
,
&
var_dlength
,
&
flagVec
implicit
none
public
::
getSummaVariableInfo
public
::
prepare
_o
utput
public
::
prepare
O
utput
contains
subroutine
getSummaVariableInfo
(
var_type
,
var_fortran_index
,
data_struct
)
bind
(
C
,
name
=
"getSummaVariableInfo"
)
integer
(
c_int
)
::
var_type
...
...
@@ -14,9 +21,122 @@ subroutine getSummaVariableInfo(var_type, var_fortran_index, data_struct) bind(C
end
subroutine
getSummaVariableInfo
subroutine
prepareOutput
()
bind
(
C
,
name
=
"prepareOutput"
)
subroutine
prepareOutput
(&
modelTimeStep
,
&
! statistics variables
forcStat
,
&
! model forcing data
progStat
,
&
! model prognostic (state) variables
diagStat
,
&
! model diagnostic variables
fluxStat
,
&
! model fluxes
indxStat
,
&
! model indices
bvarStat
,
&
! basin-average variables
! primary data structures (scalars)
timeStruct
,
&
! x%var(:) -- model time data
forcStruct
,
&
! x%var(:) -- model forcing data
attrStruct
,
&
! x%var(:) -- local attributes for each HRU
typeStruct
,
&
! x%var(:) -- local classification of soil veg etc. for each HRU
! primary data structures (variable length vectors)
indxStruct
,
&
! x%var(:)%dat -- model indices
mparStruct
,
&
! x%var(:)%dat -- model parameters
progStruct
,
&
! x%var(:)%dat -- model prognostic (state) variables
diagStruct
,
&
! x%var(:)%dat -- model diagnostic variables
fluxStruct
,
&
! x%var(:)%dat -- model fluxes
! basin-average structures
bparStruct
,
&
! x%var(:) -- basin-average parameters
bvarStruct
,
&
! x%var(:)%dat -- basin-average variables
statCounter
,
&
outputTimeStep
,
&
! x%var(:)
resetStats
,
&
! x%var(:)
finalizeStats
,
&
! x%var(:)
finshTime
,
&
! x%var(:) -- end time for the model simulation
oldTime
,
&
! x%var(:) -- time for the previous model time step
outputStep
,
&
! index into the output Struc
err
,
message
)
USE
globalData
,
only
:
structInfo
USE
globalData
,
only
:
startWrite
,
endWrite
USE
globalData
,
only
:
ixProgress
! define frequency to write progress
USE
globalData
,
only
:
ixRestart
! define frequency to write restart files
USE
globalData
,
only
:
gru_struc
USE
globalData
,
only
:
newOutputFile
! define option for new output files
USE
summa_alarms
,
only
:
summa_setWriteAlarms
USE
globalData
,
only
:
forc_meta
,
attr_meta
,
type_meta
! metaData structures
USE
output_stats
,
only
:
calcStats
! module for compiling output statistics
USE
outputStrucWrite_module
,
only
:
writeParm
! module to write model parameters
USE
time_utils_module
,
only
:
elapsedSec
! calculate the elapsed time
USE
globalData
,
only
:
elapsedWrite
USE
var_lookup
,
only
:
iLookTIME
! named variables for time data structure
USE
var_lookup
,
only
:
iLookDIAG
! named variables for local column model diagnostic variables
USE
var_lookup
,
only
:
iLookPROG
! named variables for local column model prognostic variables
USE
var_lookup
,
only
:
iLookINDEX
! named variables for local column index variables
USE
var_lookup
,
only
:
iLookFreq
! named variables for the frequency structure
USE
var_lookup
,
only
:
maxvarFreq
! maximum number of output files
USE
globalData
,
only
:
time_meta
! metadata on the model time
USE
globalData
,
only
:
forc_meta
! metadata on the model forcing data
USE
globalData
,
only
:
diag_meta
! metadata on the model diagnostic variables
USE
globalData
,
only
:
prog_meta
! metadata on the model prognostic variables
USE
globalData
,
only
:
flux_meta
! metadata on the model fluxes
USE
globalData
,
only
:
indx_meta
! metadata on the model index variables
USE
globalData
,
only
:
bvar_meta
! metadata on basin-average variables
USE
globalData
,
only
:
bpar_meta
! basin parameter metadata structure
USE
globalData
,
only
:
mpar_meta
! local parameter metadata structure
! child metadata for stats
USE
globalData
,
only
:
statForc_meta
! child metadata for stats
USE
globalData
,
only
:
statProg_meta
! child metadata for stats
USE
globalData
,
only
:
statDiag_meta
! child metadata for stats
USE
globalData
,
only
:
statFlux_meta
! child metadata for stats
USE
globalData
,
only
:
statIndx_meta
! child metadata for stats
USE
globalData
,
only
:
statBvar_meta
! child metadata for stats
! index of the child data structure
USE
globalData
,
only
:
forcChild_map
! index of the child data structure: stats forc
USE
globalData
,
only
:
progChild_map
! index of the child data structure: stats prog
USE
globalData
,
only
:
diagChild_map
! index of the child data structure: stats diag
USE
globalData
,
only
:
fluxChild_map
! index of the child data structure: stats flux
USE
globalData
,
only
:
indxChild_map
! index of the child data structure: stats indx
USE
globalData
,
only
:
bvarChild_map
! index of the child data structure: stats bvar
implicit
none
integer
(
i4b
),
intent
(
in
)
::
modelTimeStep
! time step index
type
(
var_dlength
),
intent
(
inout
)
::
forcStat
! model forcing data
type
(
var_dlength
),
intent
(
inout
)
::
progStat
! model prognostic (state) variables
type
(
var_dlength
),
intent
(
inout
)
::
diagStat
! model diagnostic variables
type
(
var_dlength
),
intent
(
inout
)
::
fluxStat
! model fluxes
type
(
var_dlength
),
intent
(
inout
)
::
indxStat
! model indices
type
(
var_dlength
),
intent
(
inout
)
::
bvarStat
! basin-average variabl
! primary data structures (scalars)
type
(
var_i
),
intent
(
inout
)
::
timeStruct
! model time data
type
(
var_d
),
intent
(
inout
)
::
forcStruct
! model forcing data
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
! primary data structures (variable length vectors)
type
(
var_ilength
),
intent
(
inout
)
::
indxStruct
! model indices
type
(
var_dlength
),
intent
(
inout
)
::
mparStruct
! model parameters
type
(
var_dlength
),
intent
(
inout
)
::
progStruct
! model prognostic (state) variables
type
(
var_dlength
),
intent
(
inout
)
::
diagStruct
! model diagnostic variables
type
(
var_dlength
),
intent
(
inout
)
::
fluxStruct
! model fluxes
! basin-average structures
type
(
var_d
),
intent
(
inout
)
::
bparStruct
! basin-average parameters
type
(
var_dlength
),
intent
(
inout
)
::
bvarStruct
! basin-average variables
! local HRU data
type
(
var_i
),
intent
(
inout
)
::
statCounter
! time counter for stats
type
(
var_i
),
intent
(
inout
)
::
outputTimeStep
! timestep in output files
type
(
flagVec
),
intent
(
inout
)
::
resetStats
! flags to reset statistics
type
(
flagVec
),
intent
(
inout
)
::
finalizeStats
! flags to finalize statistics
type
(
var_i
),
intent
(
inout
)
::
finshTime
! end time for the model simulation
type
(
var_i
),
intent
(
inout
)
::
oldTime
!
integer
(
i4b
),
intent
(
in
)
::
outputStep
! index into the outputStructure
! run time variables
integer
(
i4b
),
intent
(
out
)
::
err
character
(
*
),
intent
(
out
)
::
message
character
(
len
=
256
)
::
cmessage
logical
(
lgt
)
::
defNewOutputFile
=
.false.
integer
(
i4b
)
::
iFreq
! index of the output frequency
integer
(
i4b
)
::
iStruct
! index of model structure
logical
(
lgt
)
::
printProgress
=
.false.
logical
(
lgt
)
::
printRestart
=
.false.
...
...
@@ -53,34 +173,6 @@ subroutine prepareOutput() bind(C, name="prepareOutput")
err
,
cmessage
)
! error control
if
(
err
/
=
0
)
then
;
message
=
trim
(
message
)//
trim
(
cmessage
);
return
;
endif
! check the need to create a new output file
if
(
modelTimeStep
==
1
)
then
! define summa output files
! initialize error control
err
=
0
;
message
=
'summaActors_defineOuputParm/'
! write parameters for the HRU
do
iStruct
=
1
,
size
(
structInfo
)
select
case
(
trim
(
structInfo
(
iStruct
)
%
structName
))
case
(
'attr'
);
call
writeParm
(
indxGRU
,
indxHRU
,
gru_struc
(
indxGRU
)
%
hruInfo
(
indxHRU
)
%
hru_ix
,
&
attrStruct
,
attr_meta
,
'attr'
,
err
,
cmessage
)
case
(
'type'
);
call
writeParm
(
indxGRU
,
indxHRU
,
gru_struc
(
indxGRU
)
%
hruInfo
(
indxHRU
)
%
hru_ix
,
&
typeStruct
,
type_meta
,
'type'
,
err
,
cmessage
)
case
(
'mpar'
);
call
writeParm
(
indxGRU
,
indxHRU
,
gru_struc
(
indxGRU
)
%
hruInfo
(
indxHRU
)
%
hru_ix
,
&
mparStruct
,
mpar_meta
,
'mpar'
,
err
,
cmessage
)
end
select
if
(
err
/
=
0
)
then
;
message
=
trim
(
message
)//
trim
(
cmessage
)//
'['
//
trim
(
structInfo
(
iStruct
)
%
structName
)//
']'
;
return
;
endif
end
do
! (looping through structures)
! write GRU parameters
call
writeParm
(
indxGRU
,
indxHRU
,
integerMissing
,
bparStruct
,
bpar_meta
,
'bpar'
,
err
,
cmessage
)
if
(
err
/
=
0
)
then
;
message
=
trim
(
message
)//
trim
(
cmessage
);
return
;
endif
! re-initalize the indices for model writing
outputTimeStep
%
var
(:)
=
1
end
if
! if defining a new file
! If we do not do this looping we segfault - I am not sure why
! outputStructure(1)%finalizeStats(1)%gru(indxGRU)%hru(indxHRU)%tim(outputStep)%dat(:) = finalizeStats%dat(:)
! ****************************************************************************
! *** calculate output statistics
! ****************************************************************************
...
...
This diff is collapsed.
Click to expand it.
build/source/driver/summaActors_wOutputStruc.f90
+
0
−
2
View file @
537e7023
...
...
@@ -116,8 +116,6 @@ subroutine summaActors_writeToOutputStruc(&
USE
time_utils_module
,
only
:
elapsedSec
! calculate the elapsed time
USE
globalData
,
only
:
elapsedWrite
! elapsed time to write data
USE
globalData
,
only
:
outputStructure
USE
netcdf_util_module
,
only
:
nc_file_close
! close netcdf file
USE
netcdf_util_module
,
only
:
nc_file_open
! open netcdf file
implicit
none
integer
(
i4b
),
intent
(
in
)
::
indxHRU
! index of hru in GRU
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment