diff --git a/config-ex/config-mosaic.txt b/config-ex/config-mosaic.txt index 8750ecfc886f2e570a068364ac303ad3d4b1eb4f..8f6c11bc60458955a5d7a60e8eea3afd18d16db8 100644 --- a/config-ex/config-mosaic.txt +++ b/config-ex/config-mosaic.txt @@ -6,7 +6,7 @@ dataset { # --- redefine dataset # filename = "data/mosaic.txt"; - # surface_type = "land"; + # surface = "land"; # h = 3.8; # measurement height [m] # z0_m = 0.01; # aerodynamic roughness [m] # z0_h = -1; # no prescribed value diff --git a/srcF/sfx_run.f90 b/srcF/sfx_run.f90 index 531a77bfea6e8f27a28b51b8cbb68d4194a9273f..db251c48ede8cb5fd89cfba05940f0c1d2623109 100644 --- a/srcF/sfx_run.f90 +++ b/srcF/sfx_run.f90 @@ -24,6 +24,7 @@ contains use sfx_phys_const use sfx_common use sfx_config + use sfx_surface use sfx_io use sfx_data @@ -72,7 +73,7 @@ contains write(*, '(a,a)') ' dataset = ', trim(get_dataset_tag(dataset%id)) write(*, '(a,a)') ' filename[IN] = ', trim(dataset%filename) 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)') ' z0(m) = ', dataset%z0_m write(*, '(a,g0)') ' z0(h) = ', dataset%z0_h @@ -170,6 +171,7 @@ contains use sfx_common use sfx_config + use sfx_surface ! -------------------------------------------------------------------------------- character(len=:), allocatable, intent(out) :: filename_out @@ -220,7 +222,8 @@ contains write(*, *) ' --dataset [key]' write(*, *) ' key = mosaic (default) || irgason || sheba' 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(*, *) ' set output filename' write(*, *) ' --config [filename]' @@ -260,16 +263,24 @@ contains if (dataset%id == dataset_user) then !< @brief user-defined dataset - if (i + 5 > num_args) then + if (i + 6 > num_args) then write(*, *) ' FAILURE! > incorrect arguments for [user] dataset' stop end if !< filename call get_command_argument(i + 2, dataset%filename) + + !< surface type + 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 + 3, arg) + call get_command_argument(i + 4, arg) call str2real(dataset%h, arg, status) if (status /= 0) then write(*, *) ' FAILURE! > expecting real h [value]' @@ -281,7 +292,7 @@ contains end if !< reading 'z0(m)' - call get_command_argument(i + 4, arg) + call get_command_argument(i + 5, arg) call str2real(dataset%z0_m, arg, status) if (status /= 0) then write(*, *) ' FAILURE! > expecting real z0(m) [value]' @@ -289,7 +300,7 @@ contains end if !< reading 'z0(h)' - call get_command_argument(i + 5, arg) + call get_command_argument(i + 6, arg) call str2real(dataset%z0_h, arg, status) if (status /= 0) then write(*, *) ' FAILURE! > expecting real z0(h) [value]' @@ -366,6 +377,18 @@ contains ! *: check status dataset%filename = char_array2str(config_field) 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) if ((status /= 0).or.(dataset%id == dataset_user)) then