Skip to content

Commit a92e3e6

Browse files
committed
change tile_types to numbers that are consistent throughout
1 parent 250f7b5 commit a92e3e6

File tree

4 files changed

+26
-58
lines changed

4 files changed

+26
-58
lines changed

GEOS_LdasGridComp.F90

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module GEOS_LdasGridCompMod
2020
use LDAS_TileCoordType, only: tile_coord_type , T_TILECOORD_STATE, TILECOORD_WRAP
2121
use LDAS_TileCoordType, only: grid_def_type, io_grid_def_type, operator (==)
2222
use LDAS_TileCoordRoutines, only: get_minExtent_grid, get_ij_ind_from_latlon, io_domain_files
23-
use LDAS_ConvertMod, only: esmf2ldas, string2tile_types
23+
use LDAS_ConvertMod, only: esmf2ldas
2424
use LDAS_PertRoutinesMod, only: get_pert_grid
2525
use LDAS_ensdrv_functions, only: get_io_filename
2626
use LDAS_DateTimeMod, only: date_time_type
@@ -89,16 +89,17 @@ subroutine SetServices(gc, rc)
8989
character(len=ESMF_MAXSTR) :: Iam
9090
character(len=ESMF_MAXSTR) :: comp_name
9191
character(len=ESMF_MAXSTR) :: ensid_string,childname
92-
character(len=ESMF_MAXSTR) :: LAND_ASSIM_STR, mwRTM_file, ENS_FORCING_STR, TILE_TYPES_STR
92+
character(len=ESMF_MAXSTR) :: LAND_ASSIM_STR, mwRTM_file, ENS_FORCING_STR
9393
integer :: ens_id_width
94-
character(10), allocatable :: tile_types(:)
94+
integer, allocatable :: tile_types(:)
9595
! Local variables
9696
type(T_TILECOORD_STATE), pointer :: tcinternal
9797
type(TILECOORD_WRAP) :: tcwrap
9898

9999
type(ESMF_Config) :: CF
100-
integer :: LSM_CHOICE
100+
integer :: LSM_CHOICE, NRA
101101
integer :: FIRST_ENS_ID
102+
logical :: isPresent
102103

103104
! Begin...
104105

@@ -155,18 +156,24 @@ subroutine SetServices(gc, rc)
155156
VERIFY_(STATUS)
156157
ensemble_forcing = (trim(ENS_FORCING_STR) == 'YES')
157158

158-
call MAPL_GetResource ( MAPL, TILE_TYPES_STR, Label="TILE_TYPES:", DEFAULT="LAND", RC=STATUS)
159-
VERIFY_(STATUS)
160-
TILE_TYPES_STR = ESMF_UtilStringUpperCase(TILE_TYPES_STR, rc=STATUS)
161-
VERIFY_(STATUS)
162-
call string2tile_types(TILE_TYPES_STR, tile_types)
159+
call ESMF_ConfigFindLabel( CF, LABEL="TILE_TYPES:", isPresent=isPresent, _RC)
160+
if (isPresent) then
161+
nra = ESMF_ConfigGetLen( CF, _RC)
162+
allocate(tile_types(nra))
163+
call ESMF_ConfigFindLabel( CF, LABEL="TILE_TYPES:", _RC)
164+
call ESMF_ConfigGetAttribute( CF, valueList=tile_types, count=NRA, _RC)
165+
else
166+
! default
167+
tile_types = [MAPL_LAND]
168+
endif
169+
163170
with_landice = .false.
164171
with_land = .false.
165172
! with_lake = .false.
166173
do i = 1, size(tile_types)
167-
if (trim(tile_types(i)) == 'LANDICE') with_landice = .true.
168-
if (trim(tile_types(i)) == 'LAND') with_land = .true.
169-
! if (trim(tile_types(i)) == 'LAKE') with_lake = .true.
174+
if (tile_types(i) == MAPL_LANDICE) with_landice = .true.
175+
if (tile_types(i) == MAPL_LAND) with_land = .true.
176+
! if (tile_types(i) == MAPL_LAKE) with_lake = .true.
170177
enddo
171178

172179
call MAPL_GetResource ( MAPL, LAND_ASSIM_STR, Label="LAND_ASSIM:", DEFAULT="NO", RC=STATUS)

GEOSldas_App/GEOSldas_LDAS.rc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,14 @@ LSM_CHOICE: 1
3939

4040
# ---- Choice of tile type(s)
4141
#
42-
# Comma-separated list of tile types to be included in simulation.
43-
# Do not use space before/after comma. Examples:
42+
# list of tile types to be included in simulation.
43+
# use blank space as seperator if there are more than one type
4444
#
45-
# LAND : include only land tiles
46-
# LAND,LANDICE : include land and landice tiles
47-
# LANDICE : include only landice tiles
45+
# land tiles 100
46+
# landice tiles 20
47+
# lake tiles 29 (not yet implemented)
4848
#
49-
TILE_TYPES: LAND
50-
49+
TILE_TYPES: 100
5150

5251
# ---- Format of tile file (from bcs directory)
5352
#

GEOSldas_App/ldas_setup

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ class LDASsetup:
163163
print ('\nInputs from execfile:\n')
164164
_printdict(self.rqdExeInp)
165165

166-
tile_types = {'LAND':'100', 'LANDICE':'20'}
167-
self.tile_types = [tile_types[x.strip().upper()] for x in self.rqdExeInp.get('TILE_TYPES','LAND').split(',')]
166+
self.tile_types = self.rqdExeInp.get('TILE_TYPES',["100"]).split()
168167
if "100" in self.tile_types :
169168
self.with_land = True
170169
if "20" in self.tile_types :

LDAS_Shared/LDAS_Convert.F90

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module LDAS_ConvertMod
1212
private
1313

1414
public :: esmf2ldas
15-
public :: string2tile_types
1615

1716
interface esmf2ldas
1817
module procedure esmf2ldas_time
@@ -49,42 +48,6 @@ end subroutine esmf2ldas_time
4948

5049
! --------------------------------------------
5150

52-
subroutine string2tile_types( string, tile_types)
53-
54-
! break string with list of (comma-separated) tile types into vector of strings
55-
56-
character(len=ESMF_MAXSTR), intent(in) :: string
57-
character(10), allocatable, intent(out) :: tile_types(:)
58-
59-
character(10) :: outs4(4)
60-
integer :: ntype , j, j0
61-
62-
j = index(string, ',') ! identify positions of commas (delimiter)
63-
ntype = 1
64-
j0 = 0
65-
66-
! loop through positions of commas
67-
68-
do while (.true.)
69-
if (j == 0) then
70-
outs4(ntype) = trim(adjustl(string(j0+1:)))
71-
exit
72-
endif
73-
outs4(ntype) = trim(adjustl(string(j0+1:j0+j-1)))
74-
75-
j0 = j0+j
76-
j = index(string(j0+1:), ',')
77-
ntype = ntype+1
78-
enddo
79-
80-
! assemble output vector of strings
81-
82-
allocate(tile_types(ntype), source=outs4(1:ntype))
83-
84-
end subroutine string2tile_types
85-
86-
! --------------------------------------------
87-
8851
end module LDAS_ConvertMod
8952

9053
! ========= EOF ===========================================================

0 commit comments

Comments
 (0)