Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sfx
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
inmcm-mirror
sfx
Commits
6d2c8445
Commit
6d2c8445
authored
8 months ago
by
Evgeny Mortikov
Browse files
Options
Downloads
Patches
Plain Diff
moving model and dataset definitions in separate module
parent
d8a4b4bd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+1
-0
1 addition, 0 deletions
CMakeLists.txt
srcF/sfx_config.f90
+129
-0
129 additions, 0 deletions
srcF/sfx_config.f90
srcF/sfx_main.f90
+33
-96
33 additions, 96 deletions
srcF/sfx_main.f90
with
163 additions
and
96 deletions
CMakeLists.txt
+
1
−
0
View file @
6d2c8445
...
@@ -57,6 +57,7 @@ set(SOURCES_F
...
@@ -57,6 +57,7 @@ set(SOURCES_F
srcF/sfx_io.f90
srcF/sfx_io.f90
srcF/sfx_data.f90
srcF/sfx_data.f90
srcF/sfx_common.f90
srcF/sfx_common.f90
srcF/sfx_config.f90
srcF/sfx_esm.f90
srcF/sfx_esm.f90
srcF/sfx_esm_param.f90
srcF/sfx_esm_param.f90
srcF/sfx_log.f90
srcF/sfx_log.f90
...
...
This diff is collapsed.
Click to expand it.
srcF/sfx_config.f90
0 → 100644
+
129
−
0
View file @
6d2c8445
!> @brief surface flux model config subroutines
module
sfx_config
! modules used
! --------------------------------------------------------------------------------
! --------------------------------------------------------------------------------
! directives list
! --------------------------------------------------------------------------------
implicit
none
! --------------------------------------------------------------------------------
public
!> @brief model enum def.
integer
,
parameter
::
model_esm
=
0
!< ESM model
integer
,
parameter
::
model_log
=
1
!< LOG simplified model
integer
,
parameter
::
model_most
=
2
!< MOST simplified model
integer
,
parameter
::
model_sheba
=
3
!< SHEBA simplified model
character
(
len
=
16
),
parameter
::
model_esm_tag
=
'esm'
character
(
len
=
16
),
parameter
::
model_log_tag
=
'log'
character
(
len
=
16
),
parameter
::
model_most_tag
=
'most'
character
(
len
=
16
),
parameter
::
model_sheba_tag
=
'sheba'
!> @brief dataset enum def.
integer
,
parameter
::
dataset_mosaic
=
1
!< MOSAiC campaign
integer
,
parameter
::
dataset_irgason
=
2
!< IRGASON data
integer
,
parameter
::
dataset_sheba
=
3
!< please spell 'SHIBA'
integer
,
parameter
::
dataset_lake
=
4
!< Kuivajarvi data
integer
,
parameter
::
dataset_papa
=
5
!< Papa station (ocean) data
integer
,
parameter
::
dataset_toga
=
6
!< Toga (ocean) data
integer
,
parameter
::
dataset_user
=
7
!< used defined dataset
character
(
len
=
16
),
parameter
::
dataset_mosaic_tag
=
'mosaic'
character
(
len
=
16
),
parameter
::
dataset_irgason_tag
=
'irgason'
character
(
len
=
16
),
parameter
::
dataset_sheba_tag
=
'sheba'
character
(
len
=
16
),
parameter
::
dataset_lake_tag
=
'lake'
character
(
len
=
16
),
parameter
::
dataset_papa_tag
=
'papa'
character
(
len
=
16
),
parameter
::
dataset_toga_tag
=
'toga'
character
(
len
=
16
),
parameter
::
dataset_user_tag
=
'user'
contains
function
get_model_id
(
tag
)
result
(
id
)
implicit
none
character
(
len
=*
),
intent
(
in
)
::
tag
integer
::
id
id
=
-
1
if
(
trim
(
tag
)
==
trim
(
model_esm_tag
))
then
id
=
model_esm
else
if
(
trim
(
tag
)
==
trim
(
model_log_tag
))
then
id
=
model_log
else
if
(
trim
(
tag
)
==
trim
(
model_most_tag
))
then
id
=
model_most
else
if
(
trim
(
tag
)
==
trim
(
model_sheba_tag
))
then
id
=
model_sheba
endif
end
function
function
get_model_tag
(
id
)
result
(
tag
)
implicit
none
integer
::
id
character
(
len
=
:),
allocatable
::
tag
tag
=
"undefined"
if
(
id
==
model_esm
)
then
tag
=
model_esm_tag
else
if
(
id
==
model_log
)
then
tag
=
model_log_tag
else
if
(
id
==
model_most
)
then
tag
=
model_most_tag
else
if
(
id
==
model_sheba
)
then
tag
=
model_sheba_tag
endif
end
function
function
get_dataset_id
(
tag
)
result
(
id
)
implicit
none
character
(
len
=*
),
intent
(
in
)
::
tag
integer
::
id
id
=
-
1
if
(
trim
(
tag
)
==
trim
(
dataset_mosaic_tag
))
then
id
=
dataset_mosaic
else
if
(
trim
(
tag
)
==
trim
(
dataset_irgason_tag
))
then
id
=
dataset_irgason
else
if
(
trim
(
tag
)
==
trim
(
dataset_sheba_tag
))
then
id
=
dataset_sheba
else
if
(
trim
(
tag
)
==
trim
(
dataset_lake_tag
))
then
id
=
dataset_lake
else
if
(
trim
(
tag
)
==
trim
(
dataset_papa_tag
))
then
id
=
dataset_papa
else
if
(
trim
(
tag
)
==
trim
(
dataset_toga_tag
))
then
id
=
dataset_toga
else
if
(
trim
(
tag
)
==
trim
(
dataset_user_tag
))
then
id
=
dataset_user
endif
end
function
function
get_dataset_tag
(
id
)
result
(
tag
)
implicit
none
integer
::
id
character
(
len
=
:),
allocatable
::
tag
tag
=
"undefined"
if
(
id
==
dataset_mosaic
)
then
tag
=
dataset_mosaic_tag
else
if
(
id
==
dataset_irgason
)
then
tag
=
dataset_irgason_tag
else
if
(
id
==
dataset_sheba
)
then
tag
=
dataset_sheba_tag
else
if
(
id
==
dataset_lake
)
then
tag
=
dataset_lake_tag
else
if
(
id
==
dataset_papa
)
then
tag
=
dataset_papa_tag
else
if
(
id
==
dataset_toga
)
then
tag
=
dataset_toga_tag
else
if
(
id
==
dataset_user
)
then
tag
=
dataset_user_tag
endif
end
function
end
module
sfx_config
This diff is collapsed.
Click to expand it.
srcF/sfx_main.f90
+
33
−
96
View file @
6d2c8445
...
@@ -11,6 +11,7 @@ program sfx_main
...
@@ -11,6 +11,7 @@ program sfx_main
use
sfx_phys_const
use
sfx_phys_const
use
sfx_common
use
sfx_common
use
sfx_config
use
sfx_io
use
sfx_io
use
sfx_data
use
sfx_data
...
@@ -36,21 +37,9 @@ program sfx_main
...
@@ -36,21 +37,9 @@ program sfx_main
integer
::
dataset_id
!< dataset ID:
integer
::
dataset_id
!< dataset ID:
character
(
len
=
256
)
::
dataset_name
character
(
len
=
256
)
::
dataset_name
integer
,
parameter
::
dataset_MOSAiC
=
1
!< MOSAiC campaign
integer
,
parameter
::
dataset_IRGASON
=
2
!< IRGASON data
integer
,
parameter
::
dataset_SHEBA
=
3
!< please spell 'SHIBA'
integer
,
parameter
::
dataset_LAKE
=
4
!< Kuivajarvi data
integer
,
parameter
::
dataset_PAPA
=
5
!< Papa station (ocean) data
integer
,
parameter
::
dataset_TOGA
=
6
!< Toga (ocean) data
integer
,
parameter
::
dataset_USER
=
7
!< used defined dataset
integer
::
model_id
!< sfx model ID
integer
::
model_id
!< sfx model ID:
character
(
len
=
256
)
::
model_name
character
(
len
=
256
)
::
model_name
integer
,
parameter
::
model_esm
=
0
!< ESM model
integer
,
parameter
::
model_log
=
1
!< LOG simplified model
integer
,
parameter
::
model_most
=
2
!< MOST simplified model
integer
,
parameter
::
model_sheba
=
3
!< SHEBA simplified model
! input/output data
! input/output data
! --------------------------------------------------------------------------------
! --------------------------------------------------------------------------------
...
@@ -84,19 +73,6 @@ program sfx_main
...
@@ -84,19 +73,6 @@ program sfx_main
character
(
len
=
128
),
parameter
::
arg_key_nmax
=
'--nmax'
character
(
len
=
128
),
parameter
::
arg_key_nmax
=
'--nmax'
character
(
len
=
128
),
parameter
::
arg_key_help
=
'--help'
character
(
len
=
128
),
parameter
::
arg_key_help
=
'--help'
character
(
len
=
128
),
parameter
::
arg_key_model_esm
=
'esm'
character
(
len
=
128
),
parameter
::
arg_key_model_log
=
'log'
character
(
len
=
128
),
parameter
::
arg_key_model_most
=
'most'
character
(
len
=
128
),
parameter
::
arg_key_model_sheba
=
'sheba'
character
(
len
=
128
),
parameter
::
arg_key_dataset_mosaic
=
'mosaic'
character
(
len
=
128
),
parameter
::
arg_key_dataset_irgason
=
'irgason'
character
(
len
=
128
),
parameter
::
arg_key_dataset_sheba
=
'sheba'
character
(
len
=
128
),
parameter
::
arg_key_dataset_lake
=
'lake'
character
(
len
=
128
),
parameter
::
arg_key_dataset_papa
=
'papa'
character
(
len
=
128
),
parameter
::
arg_key_dataset_toga
=
'toga'
character
(
len
=
128
),
parameter
::
arg_key_dataset_user
=
'user'
integer
::
is_output_set
integer
::
is_output_set
integer
::
nmax
integer
::
nmax
! --------------------------------------------------------------------------------
! --------------------------------------------------------------------------------
...
@@ -119,7 +95,7 @@ program sfx_main
...
@@ -119,7 +95,7 @@ program sfx_main
!< @brief define model & dataset
!< @brief define model & dataset
model_id
=
model_esm
!< default = ESM
model_id
=
model_esm
!< default = ESM
dataset_id
=
dataset_
MOSAiC
!< default = MOSAiC
dataset_id
=
dataset_
mosaic
!< default = MOSAiC
is_output_set
=
0
is_output_set
=
0
nmax
=
0
nmax
=
0
...
@@ -148,15 +124,8 @@ program sfx_main
...
@@ -148,15 +124,8 @@ program sfx_main
stop
stop
end
if
end
if
call
get_command_argument
(
i
+
1
,
arg
)
call
get_command_argument
(
i
+
1
,
arg
)
if
(
trim
(
arg
)
==
trim
(
arg_key_model_esm
))
then
model_id
=
get_model_id
(
arg
)
model_id
=
model_esm
if
(
model_id
==
-1
)
then
else
if
(
trim
(
arg
)
==
trim
(
arg_key_model_log
))
then
model_id
=
model_log
else
if
(
trim
(
arg
)
==
trim
(
arg_key_model_most
))
then
model_id
=
model_most
else
if
(
trim
(
arg
)
==
trim
(
arg_key_model_sheba
))
then
model_id
=
model_sheba
else
write
(
*
,
*
)
' FAILURE! > unknown model [key]: '
,
trim
(
arg
)
write
(
*
,
*
)
' FAILURE! > unknown model [key]: '
,
trim
(
arg
)
stop
stop
end
if
end
if
...
@@ -167,20 +136,13 @@ program sfx_main
...
@@ -167,20 +136,13 @@ program sfx_main
stop
stop
end
if
end
if
call
get_command_argument
(
i
+
1
,
arg
)
call
get_command_argument
(
i
+
1
,
arg
)
if
(
trim
(
arg
)
==
trim
(
arg_key_dataset_mosaic
))
then
dataset_id
=
get_dataset_id
(
arg
)
dataset_id
=
dataset_MOSAiC
if
(
dataset_id
==
-1
)
then
else
if
(
trim
(
arg
)
==
trim
(
arg_key_dataset_irgason
))
then
write
(
*
,
*
)
' FAILURE! > unknown dataset [key]: '
,
trim
(
arg
)
dataset_id
=
dataset_IRGASON
stop
else
if
(
trim
(
arg
)
==
trim
(
arg_key_dataset_sheba
))
then
end
if
dataset_id
=
dataset_SHEBA
else
if
(
trim
(
arg
)
==
trim
(
arg_key_dataset_lake
))
then
if
(
dataset_id
==
dataset_user
)
then
dataset_id
=
dataset_LAKE
else
if
(
trim
(
arg
)
==
trim
(
arg_key_dataset_papa
))
then
dataset_id
=
dataset_PAPA
else
if
(
trim
(
arg
)
==
trim
(
arg_key_dataset_toga
))
then
dataset_id
=
dataset_TOGA
else
if
(
trim
(
arg
)
==
trim
(
arg_key_dataset_user
))
then
dataset_id
=
dataset_USER
if
(
i
+
4
>
num_args
)
then
if
(
i
+
4
>
num_args
)
then
write
(
*
,
*
)
' FAILURE! > incorrect arguments for [user] dataset'
write
(
*
,
*
)
' FAILURE! > incorrect arguments for [user] dataset'
stop
stop
...
@@ -188,9 +150,6 @@ program sfx_main
...
@@ -188,9 +150,6 @@ program sfx_main
call
get_command_argument
(
i
+
2
,
filename_in_common
)
call
get_command_argument
(
i
+
2
,
filename_in_common
)
call
get_command_argument
(
i
+
3
,
filename_in
)
call
get_command_argument
(
i
+
3
,
filename_in
)
call
get_command_argument
(
i
+
4
,
filename_out
)
call
get_command_argument
(
i
+
4
,
filename_out
)
else
write
(
*
,
*
)
' FAILURE! > unknown dataset [key]: '
,
trim
(
arg
)
stop
end
if
end
if
end
if
end
if
if
(
trim
(
arg
)
==
trim
(
arg_key_output
))
then
if
(
trim
(
arg
)
==
trim
(
arg_key_output
))
then
...
@@ -223,13 +182,13 @@ program sfx_main
...
@@ -223,13 +182,13 @@ program sfx_main
call
run
(
"config.txt"
//
C_NULL_CHAR
)
call
run
(
"config.txt"
//
C_NULL_CHAR
)
call
get_charf
(
"model.type"
//
C_NULL_CHAR
,
config_model_name
)
call
get_charf
(
"model.type"
//
C_NULL_CHAR
,
config_model_name
)
if
(
compare_char_arrays
(
config_model_name
,
trim
(
arg_key_
model_esm
)))
then
if
(
compare_char_arrays
(
config_model_name
,
trim
(
model_esm
_tag
)))
then
model_id
=
model_esm
model_id
=
model_esm
else
if
(
compare_char_arrays
(
config_model_name
,
trim
(
arg_key_
model_log
)))
then
else
if
(
compare_char_arrays
(
config_model_name
,
trim
(
model_log
_tag
)))
then
model_id
=
model_log
model_id
=
model_log
else
if
(
compare_char_arrays
(
config_model_name
,
trim
(
arg_key_
model_most
)))
then
else
if
(
compare_char_arrays
(
config_model_name
,
trim
(
model_most
_tag
)))
then
model_id
=
model_most
model_id
=
model_most
else
if
(
compare_char_arrays
(
config_model_name
,
trim
(
arg_key_
model_sheba
)))
then
else
if
(
compare_char_arrays
(
config_model_name
,
trim
(
model_sheba
_tag
)))
then
model_id
=
model_sheba
model_id
=
model_sheba
else
else
write
(
*
,
*
)
' FAILURE! > unknown model [key]: '
,
config_model_name
write
(
*
,
*
)
' FAILURE! > unknown model [key]: '
,
config_model_name
...
@@ -237,19 +196,19 @@ program sfx_main
...
@@ -237,19 +196,19 @@ program sfx_main
end
if
end
if
call
get_charf
(
"dataset.type"
//
C_NULL_CHAR
,
config_dataset_name
)
call
get_charf
(
"dataset.type"
//
C_NULL_CHAR
,
config_dataset_name
)
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
arg_key_
dataset_mosaic
)))
then
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
dataset_mosaic
_tag
)))
then
dataset_id
=
dataset_MOSAiC
dataset_id
=
dataset_MOSAiC
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
arg_key_
dataset_irgason
)))
then
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
dataset_irgason
_tag
)))
then
dataset_id
=
dataset_IRGASON
dataset_id
=
dataset_IRGASON
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
arg_key_
dataset_sheba
)))
then
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
dataset_sheba
_tag
)))
then
dataset_id
=
dataset_SHEBA
dataset_id
=
dataset_SHEBA
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
arg_key_
dataset_lake
)))
then
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
dataset_lake
_tag
)))
then
dataset_id
=
dataset_LAKE
dataset_id
=
dataset_LAKE
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
arg_key_
dataset_papa
)))
then
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
dataset_papa
_tag
)))
then
dataset_id
=
dataset_PAPA
dataset_id
=
dataset_PAPA
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
arg_key_
dataset_toga
)))
then
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
dataset_toga
_tag
)))
then
dataset_id
=
dataset_TOGA
dataset_id
=
dataset_TOGA
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
arg_key_
dataset_user
)))
then
else
if
(
compare_char_arrays
(
config_dataset_name
,
trim
(
dataset_user
_tag
)))
then
dataset_id
=
dataset_USER
dataset_id
=
dataset_USER
!call get_charf("dataset.filename"//C_NULL_CHAR, config_dataset_filename)
!call get_charf("dataset.filename"//C_NULL_CHAR, config_dataset_filename)
...
@@ -285,58 +244,36 @@ program sfx_main
...
@@ -285,58 +244,36 @@ program sfx_main
#endif
#endif
!< @brief set name for specific model
!< @brief set name for specific model
if
(
model_id
==
model_esm
)
then
model_name
=
get_model_tag
(
model_id
)
model_name
=
"ESM"
else
if
(
model_id
==
model_log
)
then
model_name
=
"LOG"
else
if
(
model_id
==
model_most
)
then
model_name
=
"MOST"
else
if
(
model_id
==
model_sheba
)
then
model_name
=
"SHEBA"
else
write
(
*
,
*
)
' FAILURE! > unknown model id: '
,
model_id
stop
end
if
!< @brief set name & filenames for specific dataset
!< @brief set name & filenames for specific dataset
if
(
dataset_id
==
dataset_MOSAiC
)
then
dataset_name
=
get_dataset_tag
(
dataset_id
)
dataset_name
=
'MOSAiC'
if
(
dataset_id
==
dataset_mosaic
)
then
filename_in_common
=
'data/MOSAiC_zh.txt'
filename_in_common
=
'data/MOSAiC_zh.txt'
filename_in
=
'data/MOSAiC.txt'
filename_in
=
'data/MOSAiC.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_MOSAiC.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_MOSAiC.txt'
else
if
(
dataset_id
==
dataset_IRGASON
)
then
else
if
(
dataset_id
==
dataset_irgason
)
then
dataset_name
=
'IRGASON'
filename_in_common
=
'data/IRGASON_zh.txt'
filename_in_common
=
'data/IRGASON_zh.txt'
filename_in
=
'data/Irgason1.txt'
filename_in
=
'data/Irgason1.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_IRGASON1.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_IRGASON1.txt'
else
if
(
dataset_id
==
dataset_SHEBA
)
then
else
if
(
dataset_id
==
dataset_sheba
)
then
dataset_name
=
'SHEBA'
filename_in_common
=
'data/Sheba1_zh.txt'
filename_in_common
=
'data/Sheba1_zh.txt'
filename_in
=
'data/Sheba1.txt'
filename_in
=
'data/Sheba1.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_Sheba.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_Sheba.txt'
else
if
(
dataset_id
==
dataset_LAKE
)
then
else
if
(
dataset_id
==
dataset_lake
)
then
dataset_name
=
'LAKE'
filename_in_common
=
'data/Kuivajarvi_zh.txt'
filename_in_common
=
'data/Kuivajarvi_zh.txt'
filename_in
=
'data/Kuivajarvi.txt'
filename_in
=
'data/Kuivajarvi.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_Kuivajarvi.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_Kuivajarvi.txt'
else
if
(
dataset_id
==
dataset_PAPA
)
then
else
if
(
dataset_id
==
dataset_papa
)
then
dataset_name
=
'PAPA'
filename_in_common
=
'data/Papa_zh.txt'
filename_in_common
=
'data/Papa_zh.txt'
filename_in
=
'data/Papa.txt'
filename_in
=
'data/Papa.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_Papa.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_Papa.txt'
else
if
(
dataset_id
==
dataset_TOGA
)
then
else
if
(
dataset_id
==
dataset_toga
)
then
dataset_name
=
'TOGA'
filename_in_common
=
'data/Toga_zh.txt'
filename_in_common
=
'data/Toga_zh.txt'
filename_in
=
'data/Toga.txt'
filename_in
=
'data/Toga.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_Toga.txt'
if
(
is_output_set
==
0
)
filename_out
=
'out_Toga.txt'
else
if
(
dataset_id
==
dataset_
USER
)
then
else
if
(
dataset_id
==
dataset_
user
)
then
dataset_name
=
'USER'
! ---> skipping
else
else
write
(
*
,
*
)
' FAILURE! > unknown dataset id: '
,
dataset_id
write
(
*
,
*
)
' FAILURE! > unknown dataset id: '
,
dataset_id
stop
stop
...
...
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