Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flexinvertplus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
flexpart
flexinvertplus
Commits
82dbbfe6
Commit
82dbbfe6
authored
6 years ago
by
ronesy
Browse files
Options
Downloads
Patches
Plain Diff
Added writing and reading of correl.txt file for spatial correlations
parent
00ba3750
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
source/correl.f90
+13
-1
13 additions, 1 deletion
source/correl.f90
source/init_co2.f90
+13
-1
13 additions, 1 deletion
source/init_co2.f90
source/init_ghg.f90
+15
-1
15 additions, 1 deletion
source/init_ghg.f90
with
41 additions
and
3 deletions
source/correl.f90
+
13
−
1
View file @
82dbbfe6
...
...
@@ -26,18 +26,20 @@
!! Interface:
!!
!! Inputs
!! files - file data structure
!! config - configuration settings data structure
!! corr - correlation matrix (zero matrix on input)
!!
!---------------------------------------------------------------------------------------
subroutine
correl
(
config
,
corr
)
subroutine
correl
(
files
,
config
,
corr
)
use
mod_var
use
mod_settings
implicit
none
type
(
files_t
),
intent
(
in
)
::
files
type
(
config_t
),
intent
(
in
)
::
config
real
,
dimension
(
nbox
,
nbox
),
intent
(
in
out
)
::
corr
...
...
@@ -47,6 +49,8 @@ subroutine correl(config, corr)
real
::
pih
,
cor
,
dd
,
ddx
,
num
real
::
lat1
,
lat2
,
lon1
,
lon2
real
::
sigma1
,
sigma2
character
(
len
=
max_path_len
)
::
rowfmt
integer
::
ierr
pih
=
pi
/
180.
...
...
@@ -114,6 +118,14 @@ subroutine correl(config, corr)
end
do
! ind2
end
do
! ind1
! save correlations to file
open
(
100
,
file
=
trim
(
files
%
path_output
)//
'correl.txt'
,
action
=
'write'
,
status
=
'replace'
,
iostat
=
ierr
)
write
(
rowfmt
,
'(A,I6,A)'
)
'('
,
nbox
,
'(E11.4,1X))'
print
*
,
rowfmt
do
ix
=
1
,
nbox
write
(
100
,
fmt
=
rowfmt
)
corr
(
ix
,:)
end
do
close
(
100
)
end
subroutine
correl
This diff is collapsed.
Click to expand it.
source/init_co2.f90
+
13
−
1
View file @
82dbbfe6
...
...
@@ -604,7 +604,19 @@ subroutine init_co2(files, config, fluxes, obs, states, covar)
corr
(:,:)
=
0.
if
(
config
%
spa_corr
)
then
write
(
logid
,
*
)
'Using spatial correlation in B'
call
correl
(
config
,
corr
)
! check if file already exists (in case of rerun)
inquire
(
file
=
trim
(
files
%
path_output
)//
'correl.txt'
,
exist
=
lexist
)
if
(
lexist
)
then
write
(
logid
,
*
)
'Reading spatial correlation from correl.txt'
open
(
100
,
file
=
trim
(
files
%
path_output
)//
'correl.txt'
,
action
=
'read'
,
status
=
'old'
,
iostat
=
ierr
)
write
(
rowfmt
,
'(A,I6,A)'
)
'('
,
nbox
,
'(E11.4,1X))'
do
nb
=
1
,
nbox
read
(
100
,
rowfmt
)
corr
(
nb
,:)
end
do
close
(
100
)
else
call
correl
(
files
,
config
,
corr
)
endif
else
do
n
=
1
,
nbox
corr
(
n
,
n
)
=
1.
...
...
This diff is collapsed.
Click to expand it.
source/init_ghg.f90
+
15
−
1
View file @
82dbbfe6
...
...
@@ -337,7 +337,21 @@ subroutine init_ghg(files, config, fluxes, obs, states, covar)
corr
(:,:)
=
0.
if
(
config
%
spa_corr
)
then
write
(
logid
,
*
)
'Using spatial correlation in B'
call
correl
(
config
,
corr
)
! check if file already exists (in case of rerun)
inquire
(
file
=
trim
(
files
%
path_output
)//
'correl.txt'
,
exist
=
lexist
)
if
(
lexist
)
then
write
(
logid
,
*
)
'Reading spatial correlation from correl.txt'
open
(
100
,
file
=
trim
(
files
%
path_output
)//
'correl.txt'
,
action
=
'read'
,
status
=
'old'
,
iostat
=
ierr
)
write
(
rowfmt
,
'(A,I6,A)'
)
'('
,
nbox
,
'(E11.4,1X))'
print
*
,
rowfmt
do
nb
=
1
,
nbox
read
(
100
,
fmt
=
rowfmt
)
corr
(
nb
,:)
print
*
,
corr
(
nb
,:)
end
do
close
(
100
)
else
call
correl
(
files
,
config
,
corr
)
endif
else
do
n
=
1
,
nbox
corr
(
n
,
n
)
=
1.
...
...
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