Skip to content
Snippets Groups Projects
Commit a4dc4109 authored by Evgeny Mortikov's avatar Evgeny Mortikov
Browse files

surface setup update

parent 2b1349d7
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ dataset { ...@@ -6,7 +6,7 @@ dataset {
# --- redefine dataset # --- redefine dataset
# filename = "data/mosaic.txt"; # filename = "data/mosaic.txt";
# surface_type = "land"; # surface = "land";
# h = 3.8; # measurement height [m] # h = 3.8; # measurement height [m]
# z0_m = 0.01; # aerodynamic roughness [m] # z0_m = 0.01; # aerodynamic roughness [m]
# z0_h = -1; # no prescribed value # z0_h = -1; # no prescribed value
......
...@@ -24,6 +24,7 @@ contains ...@@ -24,6 +24,7 @@ contains
use sfx_phys_const use sfx_phys_const
use sfx_common use sfx_common
use sfx_config use sfx_config
use sfx_surface
use sfx_io use sfx_io
use sfx_data use sfx_data
...@@ -72,7 +73,7 @@ contains ...@@ -72,7 +73,7 @@ contains
write(*, '(a,a)') ' dataset = ', trim(get_dataset_tag(dataset%id)) write(*, '(a,a)') ' dataset = ', trim(get_dataset_tag(dataset%id))
write(*, '(a,a)') ' filename[IN] = ', trim(dataset%filename) write(*, '(a,a)') ' filename[IN] = ', trim(dataset%filename)
write(*, '(a,a)') ' filename[OUT] = ', trim(filename_out) write(*, '(a,a)') ' filename[OUT] = ', trim(filename_out)
write(*, '(a,g0)') ' surface type = ', dataset%surface write(*, '(a,g0)') ' surface type = ', trim(get_surface_tag(dataset%surface))
write(*, '(a,g0)') ' h = ', dataset%h write(*, '(a,g0)') ' h = ', dataset%h
write(*, '(a,g0)') ' z0(m) = ', dataset%z0_m write(*, '(a,g0)') ' z0(m) = ', dataset%z0_m
write(*, '(a,g0)') ' z0(h) = ', dataset%z0_h write(*, '(a,g0)') ' z0(h) = ', dataset%z0_h
...@@ -170,6 +171,7 @@ contains ...@@ -170,6 +171,7 @@ contains
use sfx_common use sfx_common
use sfx_config use sfx_config
use sfx_surface
! -------------------------------------------------------------------------------- ! --------------------------------------------------------------------------------
character(len=:), allocatable, intent(out) :: filename_out character(len=:), allocatable, intent(out) :: filename_out
...@@ -220,7 +222,8 @@ contains ...@@ -220,7 +222,8 @@ contains
write(*, *) ' --dataset [key]' write(*, *) ' --dataset [key]'
write(*, *) ' key = mosaic (default) || irgason || sheba' write(*, *) ' key = mosaic (default) || irgason || sheba'
write(*, *) ' = lake || papa || toga || user [filename] [param]' write(*, *) ' = lake || papa || toga || user [filename] [param]'
write(*, *) ' param = [h] [z0(m)] [z0(h)]' write(*, *) ' param = [surface(type)] [h] [z0(m)] [z0(h)]'
write(*, *) ' surface(type) = ocean | land | lake | snow'
write(*, *) ' --output [filename]' write(*, *) ' --output [filename]'
write(*, *) ' set output filename' write(*, *) ' set output filename'
write(*, *) ' --config [filename]' write(*, *) ' --config [filename]'
...@@ -260,7 +263,7 @@ contains ...@@ -260,7 +263,7 @@ contains
if (dataset%id == dataset_user) then if (dataset%id == dataset_user) then
!< @brief user-defined dataset !< @brief user-defined dataset
if (i + 5 > num_args) then if (i + 6 > num_args) then
write(*, *) ' FAILURE! > incorrect arguments for [user] dataset' write(*, *) ' FAILURE! > incorrect arguments for [user] dataset'
stop stop
end if end if
...@@ -268,8 +271,16 @@ contains ...@@ -268,8 +271,16 @@ contains
!< filename !< filename
call get_command_argument(i + 2, dataset%filename) call get_command_argument(i + 2, dataset%filename)
!< reading 'h' !< surface type
call get_command_argument(i + 3, arg) call get_command_argument(i + 3, arg)
dataset%surface = get_surface_id(arg)
if (dataset%surface == -1) then
write(*, *) ' FAILURE! > unknown surface [key]: ', trim(arg)
stop
end if
!< reading 'h'
call get_command_argument(i + 4, arg)
call str2real(dataset%h, arg, status) call str2real(dataset%h, arg, status)
if (status /= 0) then if (status /= 0) then
write(*, *) ' FAILURE! > expecting real h [value]' write(*, *) ' FAILURE! > expecting real h [value]'
...@@ -281,7 +292,7 @@ contains ...@@ -281,7 +292,7 @@ contains
end if end if
!< reading 'z0(m)' !< reading 'z0(m)'
call get_command_argument(i + 4, arg) call get_command_argument(i + 5, arg)
call str2real(dataset%z0_m, arg, status) call str2real(dataset%z0_m, arg, status)
if (status /= 0) then if (status /= 0) then
write(*, *) ' FAILURE! > expecting real z0(m) [value]' write(*, *) ' FAILURE! > expecting real z0(m) [value]'
...@@ -289,7 +300,7 @@ contains ...@@ -289,7 +300,7 @@ contains
end if end if
!< reading 'z0(h)' !< reading 'z0(h)'
call get_command_argument(i + 5, arg) call get_command_argument(i + 6, arg)
call str2real(dataset%z0_h, arg, status) call str2real(dataset%z0_h, arg, status)
if (status /= 0) then if (status /= 0) then
write(*, *) ' FAILURE! > expecting real z0(h) [value]' write(*, *) ' FAILURE! > expecting real z0(h) [value]'
...@@ -367,6 +378,18 @@ contains ...@@ -367,6 +378,18 @@ contains
dataset%filename = char_array2str(config_field) dataset%filename = char_array2str(config_field)
end if end if
call c_config_is_varname("dataset.surface"//C_NULL_CHAR, status)
if ((status /= 0).or.(dataset%id == dataset_user)) then
!< mandatory in user dataset
call c_config_get_string("dataset.surface"//C_NULL_CHAR, config_field, status)
! *: check status
dataset%surface = get_surface_id(char_array2str(config_field))
if (dataset%surface == -1) then
write(*, *) ' FAILURE! > unknown surface [key]: ', trim(char_array2str(config_field))
stop
end if
endif
call c_config_is_varname("dataset.h"//C_NULL_CHAR, status) call c_config_is_varname("dataset.h"//C_NULL_CHAR, status)
if ((status /= 0).or.(dataset%id == dataset_user)) then if ((status /= 0).or.(dataset%id == dataset_user)) then
!< mandatory in user dataset !< mandatory in user dataset
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment