forked from NASA-LIS/LISF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLISlsmTEFF_obsMod.F90
340 lines (277 loc) · 13.3 KB
/
LISlsmTEFF_obsMod.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
!-----------------------BEGIN NOTICE -- DO NOT EDIT-----------------------
! NASA Goddard Space Flight Center
! Land Information System Framework (LISF)
! Version 7.5
!
! Copyright (c) 2020 United States Government as represented by the
! Administrator of the National Aeronautics and Space Administration.
! All Rights Reserved.
!-------------------------END NOTICE -- DO NOT EDIT-----------------------
module LISlsmTEFF_obsMod
!BOP
!
! !MODULE: LISlsmTEFF_obsMod
!
! !DESCRIPTION:
! This module handles the use of a LIS model simulation
! output as "observations" for data assimilation. This
! plugin is typically used to handle the computations of
! scaling factors such as cumulative distribution function
! (CDF) for use in DA
!
! !REVISION HISTORY:
! 02 Oct 2008 Sujay Kumar Initial Specification
! 01 Nov 2021 Yonghwan Kwon: Modified for effective soil temperature
!
PRIVATE
!-----------------------------------------------------------------------------
! !PUBLIC MEMBER FUNCTIONS:
!-----------------------------------------------------------------------------
PUBLIC :: LISlsmTEFF_obsInit
!-----------------------------------------------------------------------------
! !PUBLIC TYPES:
!-----------------------------------------------------------------------------
PUBLIC :: lsmteffobs
!
!EOP
type, public :: lsmteffobsdec
integer :: nvars
integer :: nest
integer :: nc,nr
real :: datares
real :: run_dd(8)
character*50 :: map_proj
character*50 :: format
character*50 :: wstyle
character*50 :: wopt
character*100 :: odir
character*20 :: security_class
character*20 :: distribution_class
character*20 :: data_category
character*20 :: area_of_data
character*20 :: write_interval
!--------------------------------------------------------
! interpolation/upscaling weights
!--------------------------------------------------------
integer, allocatable :: n11(:)
integer, allocatable :: n12(:)
integer, allocatable :: n21(:)
integer, allocatable :: n22(:)
real, allocatable :: w11(:)
real, allocatable :: w12(:)
real, allocatable :: w21(:)
real, allocatable :: w22(:)
end type lsmteffobsdec
type(lsmteffobsdec) :: lsmteffobs
contains
!BOP
! !ROUTINE: LISlsmTEFF_obsInit
! \label{LISlsmTEFF_obsInit}
!
! !INTERFACE:
subroutine LISlsmTEFF_obsInit()
! !USES:
use ESMF
use LDT_coreMod
use LDT_DAobsDataMod
use LDT_logMod
implicit none
!
! !DESCRIPTION:
! This routine initializes the structures required for the handling of a
! land surface model output (from a LIS simulation) as observations.
!
!EOP
integer :: n
integer :: rc
real :: gridDesci(20)
n = 1
lsmteffobs%run_dd = LDT_rc%udef
lsmteffobs%security_class = ''
lsmteffobs%distribution_class = ''
lsmteffobs%data_category = ''
lsmteffobs%area_of_data = ''
lsmteffobs%write_interval = ''
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%format, &
label="LIS soil temperature output format:",rc=rc)
call LDT_verify(rc,'LIS soil temperature output format: not defined')
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%wopt, &
label="LIS soil temperature output methodology:",rc=rc)
call LDT_verify(rc,'LIS soil temperature output methodology: not defined')
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%wstyle, &
label="LIS soil temperature output naming style:",rc=rc)
call LDT_verify(rc,'LIS soil temperature output naming style: not defined')
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%map_proj, &
label="LIS soil temperature output map projection:",rc=rc)
call LDT_verify(rc,'LIS soil temperature output map projection: not defined')
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%nest, &
label="LIS soil temperature output nest index:",rc=rc)
call LDT_verify(rc,'LIS soil temperature output nest index: not defined')
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%odir, &
label="LIS soil temperature output directory:",rc=rc)
call LDT_verify(rc,'LIS soil temperature output directory: not defined')
! WMO-convention specific identifiers
if ( lsmteffobs%wstyle == "WMO convention") then
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%security_class, &
label="LIS soil temperature security class:",rc=rc)
call LDT_verify(rc,'LIS soil temperature security class: not defined')
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%distribution_class, &
label="LIS soil temperature distribution class:",rc=rc)
call LDT_verify(rc,'LIS soil temperature distribution class: not defined')
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%data_category, &
label="LIS soil temperature data category:",rc=rc)
call LDT_verify(rc,'LIS soil temperature data category: not defined')
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%area_of_data, &
label="LIS soil temperature area of data:",rc=rc)
call LDT_verify(rc,'LIS soil temperature area of data: not defined')
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%write_interval, &
label="LIS soil temperature write interval:",rc=rc)
call LDT_verify(rc,'LIS soil temperature write interval: not defined')
endif
if(lsmteffobs%map_proj.eq."latlon") then
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain lower left lat:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(1),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain lower left lon:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(2),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain upper right lat:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(3),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain upper right lon:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(4),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain resolution (dx):",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(5),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain resolution (dy):",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(6),rc=rc)
lsmteffobs%datares = min(lsmteffobs%run_dd(5),lsmteffobs%run_dd(6))
lsmteffobs%nc = (nint((lsmteffobs%run_dd(4)-lsmteffobs%run_dd(2))/&
lsmteffobs%run_dd(5))) + 1
lsmteffobs%nr = (nint((lsmteffobs%run_dd(3)-lsmteffobs%run_dd(1))/&
lsmteffobs%run_dd(6))) + 1
gridDesci = 0
gridDesci(1) = 0
gridDesci(2) = lsmteffobs%nc
gridDesci(3) = lsmteffobs%nr
gridDesci(4) = lsmteffobs%run_dd(1)
gridDesci(5) = lsmteffobs%run_dd(2)
gridDesci(6) = 128
gridDesci(7) = lsmteffobs%run_dd(3)
gridDesci(8) = lsmteffobs%run_dd(4)
gridDesci(9) = lsmteffobs%run_dd(5)
gridDesci(10) = lsmteffobs%run_dd(6)
gridDesci(20) = 64
elseif(lsmteffobs%map_proj.eq."lambert") then
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain lower left lat:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(1),rc=rc)
call LDT_verify(rc,'LIS soil temperature domain lower left lat: not defined')
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain lower left lon:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(2),rc=rc)
call LDT_verify(rc,'LIS soil temperature domain lower left lon: not defined')
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain true lat1:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(3),rc=rc)
call LDT_verify(rc,'LIS soil temperature domain true lat1: not defined')
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain true lat2:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(4),rc=rc)
call LDT_verify(rc,'LIS soil temperature domain true lat2: not defined')
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain standard lon:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(5),rc=rc)
call LDT_verify(rc,'LIS soil temperature domain standard lon: not defined')
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain resolution:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(6),rc=rc)
call LDT_verify(rc,'LIS soil temperature domain resolution: not defined')
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain x-dimension size:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(7),rc=rc)
call LDT_verify(rc,'LIS soil temperature domain x-dimension size: not defined')
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain y-dimension size:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(8),rc=rc)
call LDT_verify(rc,'LIS soil temperature domain y-dimension size: not defined')
lsmteffobs%datares = lsmteffobs%run_dd(6)/100.0
lsmteffobs%nc = lsmteffobs%run_dd(7)
lsmteffobs%nr = lsmteffobs%run_dd(8)
gridDesci = 0
gridDesci(1) = 3
gridDesci(2) = lsmteffobs%nc
gridDesci(3) = lsmteffobs%nr
gridDesci(4) = lsmteffobs%run_dd(1)
gridDesci(5) = lsmteffobs%run_dd(2)
gridDesci(6) = 8
gridDesci(7) = lsmteffobs%run_dd(4)
gridDesci(8) = lsmteffobs%run_dd(6)
gridDesci(9) = lsmteffobs%run_dd(6)
gridDesci(10) = lsmteffobs%run_dd(3)
gridDesci(11) = lsmteffobs%run_dd(5)
gridDesci(20) = 64
elseif(lsmteffobs%map_proj.eq."polar") then
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain lower left lat:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(1),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain lower left lon:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(2),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain true lat1:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(3),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain true lat2:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(4),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain standard lon:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(5),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain resolution:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(6),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain x-dimension size:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(7),rc=rc)
call ESMF_ConfigFindLabel(LDT_config,&
"LIS soil temperature domain y-dimension size:",rc=rc)
call ESMF_ConfigGetAttribute(LDT_config,lsmteffobs%run_dd(8),rc=rc)
endif
!-------------------------------------------------------------------
! if the LIS output (obs) is at a coarser resolution than the
! LDT grid, then setup the weights for interpolation. Else
! setup the weights for upscaling.
!-------------------------------------------------------------------
if(LDT_isLDTatAfinerResolution(n,lsmteffobs%datares)) then
allocate(lsmteffobs%n11(LDT_rc%lnc(n)*LDT_rc%lnr(n)))
allocate(lsmteffobs%n12(LDT_rc%lnc(n)*LDT_rc%lnr(n)))
allocate(lsmteffobs%n21(LDT_rc%lnc(n)*LDT_rc%lnr(n)))
allocate(lsmteffobs%n22(LDT_rc%lnc(n)*LDT_rc%lnr(n)))
allocate(lsmteffobs%w11(LDT_rc%lnc(n)*LDT_rc%lnr(n)))
allocate(lsmteffobs%w12(LDT_rc%lnc(n)*LDT_rc%lnr(n)))
allocate(lsmteffobs%w21(LDT_rc%lnc(n)*LDT_rc%lnr(n)))
allocate(lsmteffobs%w22(LDT_rc%lnc(n)*LDT_rc%lnr(n)))
call bilinear_interp_input(n, gridDesci, &
lsmteffobs%n11, &
lsmteffobs%n12, lsmteffobs%n21, &
lsmteffobs%n22, lsmteffobs%w11, &
lsmteffobs%w12, lsmteffobs%w21, &
lsmteffobs%w22)
else
allocate(lsmteffobs%n11(&
lsmteffobs%nc*&
lsmteffobs%nr))
call upscaleByAveraging_input(&
gridDesci,&
LDT_rc%gridDesc(n,:),&
lsmteffobs%nc*lsmteffobs%nr,&
LDT_rc%lnc(n)*LDT_rc%lnr(n),&
lsmteffobs%n11)
endif
! which variable we want in the DA obs computations.
call LDT_initializeDAobsEntry(LDT_DAobsData(1)%teff_obs, "K",1,1)
LDT_DAobsData(1)%teff_obs%selectStats = 1
end subroutine LISlsmTEFF_obsInit
end module LISlsmTEFF_obsMod