Line data Source code
1 : !------------------------------------------------------------------------------
2 : ! Harmonized Emissions Component (HEMCO) !
3 : !------------------------------------------------------------------------------
4 : !BOP
5 : !
6 : ! !MODULE: hco_filedata_mod.F90
7 : !
8 : ! !DESCRIPTION: Module HCO\_Filedata\_Mod contains routines and
9 : ! variables to handle the HEMCO file data object FileData.
10 : ! FileData holds all information of source file data, such as file
11 : ! name, update frequency, temporal resolution, the data array itself,
12 : ! etc. These values are specified in the HEMCO configuration file. Many
13 : ! of these attributes are primarily used for reading/updating the data
14 : ! from file using the HEMCO generic file reading routines. Within an
15 : ! ESMF environment, these attributes may be obsolete.
16 : !\\
17 : !\\
18 : ! FileData consists of the following elements:
19 : !
20 : ! \begin{itemize}
21 : ! \item ncFile: path and filename to the source file, as specified in
22 : ! the configuration file.
23 : ! \item ncPara: file parameter (variable) of interest, as specified in
24 : ! the configuration file.
25 : ! \item ncYrs: range of years in the source file, as specified in the
26 : ! configuration file through the timestamp attribute.
27 : ! \item ncMts: range of months in the source file, as specified in the
28 : ! configuration file through the timestamp attribute.
29 : ! \item ncDys: range of days in the source file, as specified in the
30 : ! configuration file through the timestamp attribute.
31 : ! \item ncHrs: range of hours in the source file, as specified in the
32 : ! configuration file through the timestamp attribute.
33 : ! \item CycleFlag: determines how to deal with time stamps that do not
34 : ! correspond to one of the source file time slices. If set to 1,
35 : ! the closest available time slice (in the past) is used (or the
36 : ! first available time slice if model time is before first
37 : ! available time slice). If set to 2, the file data is ignored if
38 : ! model time is outside of the source file range. If CycleFlag is
39 : ! set to 3, an error is returned if none of the file time slices
40 : ! matches the model time.
41 : ! \item MustFind: if yes, the code returns with an error if no field
42 : ! can be found for the given simulation time (and according to
43 : ! the cycle flag and time attribute settings). Only of relevance
44 : ! for cycle flags range and exact.
45 : ! \item UpdtFlag: determines the update frequency of the data. This is
46 : ! currently only used to distinguish containers that are updated
47 : ! on every time step (always) or according to the frequency
48 : ! provided in the HEMCO configuration file via attribute 'srcTime'.
49 : ! \item ncRead: logical denoting whether or not we need to read this
50 : ! data container. ncRead is set to false for containers whose
51 : ! data is directly specified in the configuration file. For
52 : ! internal use only.
53 : ! \item OrigUnit: original unit of data.
54 : ! \item ArbDimName: name of additional (arbitrary) file dimension.
55 : ! \item ArbDimVal : desired value of arbitrary dimension.
56 : ! \item IsConc: Set to true if data is concentration. Concentration
57 : ! data will be added to the concentration array instead of the
58 : ! emission array.
59 : ! \item IsLocTime: Set to true if data is in local time. Defaults to
60 : ! false and becomes only true if data is scalar (e.g. uniform
61 : ! diurnal scale factors), country-specific data (read from
62 : ! ASCII), or weekdaily data.
63 : ! \item V3: vector of 3D fields. For 3D-data, this vector will hold
64 : ! the 3D arrays of all time slices kept in memory (e.g. 24
65 : ! elements for hourly data).
66 : ! \item V2: vector of 2D fields. For 2D-data, this vector will hold
67 : ! the 2D arrays of all time slices kept in memory (e.g. 24
68 : ! elements for hourly data).
69 : ! \item tIDx: derived type used for proper indexing of the time slices
70 : ! in memory. Internal use only.
71 : ! \item Cover: data coverage on this CPU: 0=no overlap; 1=full overlap;
72 : ! -1=partial overlap. As determined from the mask regions
73 : ! specified in the configuration file.
74 : ! \item SpaceDim: spatial dimension of data array: 1 = spatially uniform
75 : ! (x=y=z=1); 2 = 2D data (x,y); 3 = 3D data (x,y,z).
76 : ! \item Levels: handling of vertical levels (3D data only). For internal
77 : ! use only.
78 : ! \item nt: time dimension. length of vector V3 or V2. For internal use
79 : ! only.
80 : ! \item DeltaT: time interval between time slices. For internal use only.
81 : ! ID i (e.g. cIDList(3) points to data-container w/ cID = 3).
82 : ! \item DoShare: will be set to True if this file data object is shared
83 : ! by multiple data containers. For internal use only.
84 : ! \item IsInList: will be set to True if this file data object is part
85 : ! of the emissions list EmisList. For internal use only.
86 : ! \item IsTouched: will be set to True as soon as the container becomes
87 : ! touched for the first time. For internal use only.
88 : ! \end{itemize}
89 : !
90 : ! !INTERFACE:
91 : !
92 : MODULE HCO_FileData_Mod
93 : !
94 : ! !USES:
95 : !
96 : USE HCO_TYPES_MOD
97 : USE HCO_ERROR_MOD
98 : USE HCO_ARR_MOD
99 :
100 : IMPLICIT NONE
101 : PRIVATE
102 : !
103 : ! !PUBLIC MEMBER FUNCTIONS:
104 : !
105 : PUBLIC :: FileData_Init
106 : PUBLIC :: FileData_Cleanup
107 : PUBLIC :: FileData_ArrCheck
108 : PUBLIC :: FileData_ArrIsDefined
109 : PUBLIC :: FileData_ArrIsTouched
110 : PUBLIC :: FileData_ArrInit
111 : !
112 : ! !PRIVATE MEMBER FUNCTIONS:
113 : !
114 : PRIVATE :: FileData_ArrCheck2D
115 : PRIVATE :: FileData_ArrCheck3D
116 : !
117 : ! !REVISION HISTORY:
118 : ! 19 Dec 2013 - C. Keller - Initialization
119 : ! See https://github.com/geoschem/hemco for complete history
120 : !EOP
121 : !------------------------------------------------------------------------------
122 : !BOC
123 : !
124 : ! !PRIVATE TYPES:
125 : !
126 : !
127 : ! !INTERFACES:
128 : !
129 : INTERFACE FileData_ArrCheck
130 : MODULE PROCEDURE FileData_ArrCheck2D
131 : MODULE PROCEDURE FileData_ArrCheck3D
132 : END INTERFACE FileData_ArrCheck
133 :
134 : INTERFACE FileData_ArrInit
135 : MODULE PROCEDURE FileData_ArrInit2D
136 : MODULE PROCEDURE FileData_ArrInit3D
137 : END INTERFACE FileData_ArrInit
138 :
139 : CONTAINS
140 : !EOC
141 : !------------------------------------------------------------------------------
142 : ! Harmonized Emissions Component (HEMCO) !
143 : !------------------------------------------------------------------------------
144 : !BOP
145 : !
146 : ! !IROUTINE: FileData_Init
147 : !
148 : ! !DESCRIPTION: Subroutine FileData\_Init initializes a new (blank) file
149 : ! data object.
150 : !\\
151 : !\\
152 : ! !INTERFACE:
153 : !
154 0 : SUBROUTINE FileData_Init( FileDta )
155 : !
156 : ! !INPUT PARAMETERS:
157 : !
158 : TYPE(FileData), POINTER :: FileDta
159 : !
160 : ! !REVISION HISTORY:
161 : ! 19 Dec 2013 - C. Keller - Initialization
162 : ! See https://github.com/geoschem/hemco for complete history
163 : !EOP
164 : !------------------------------------------------------------------------------
165 : !BOC
166 : !
167 : ! !LOCAL VARIABLES:
168 : !
169 : !======================================================================
170 : ! FileData_Init begins here!
171 : !======================================================================
172 :
173 : ! Allocate memory to the FileData object
174 0 : ALLOCATE( FileDta )
175 :
176 : ! Nullify all pointers and initialize variables
177 0 : FileDta%V3 => NULL()
178 0 : FileDta%V2 => NULL()
179 0 : FileDta%tIDx => NULL()
180 0 : FileDta%ncFile = ''
181 0 : FileDta%ncPara = ''
182 0 : FileDta%ncYrs(:) = -999
183 0 : FileDta%ncMts(:) = -999
184 0 : FileDta%ncDys(:) = -999
185 0 : FileDta%ncHrs(:) = -999
186 0 : FileDta%tShift(:) = 0
187 0 : FileDta%CycleFlag = HCO_CFLAG_CYCLE
188 0 : FileDta%UpdtFlag = HCO_UFLAG_FROMFILE
189 0 : FileDta%MustFind = .FALSE.
190 0 : FileDta%ncRead = .TRUE.
191 0 : FileDta%Cover = -999
192 0 : FileDta%DeltaT = 0
193 0 : FileDta%nt = 0
194 0 : FileDta%SpaceDim = -1
195 0 : FileDta%Levels = 0
196 0 : FileDta%EmisL1 = 1.0_hp
197 0 : FileDta%EmisL2 = 1.0_hp
198 0 : FileDta%EmisL1Unit = HCO_EMISL_LEV
199 0 : FileDta%EmisL2Unit = HCO_EMISL_LEV
200 0 : FileDta%OrigUnit = ''
201 0 : FileDta%ArbDimName = 'none'
202 0 : FileDta%ArbDimVal = ''
203 0 : FileDta%IsLocTime = .FALSE.
204 0 : FileDta%IsConc = .FALSE.
205 0 : FileDta%DoShare = .FALSE.
206 0 : FileDta%IsInList = .FALSE.
207 0 : FileDta%IsTouched = .FALSE.
208 :
209 0 : END SUBROUTINE FileData_Init
210 : !EOC
211 : !------------------------------------------------------------------------------
212 : ! Harmonized Emissions Component (HEMCO) !
213 : !------------------------------------------------------------------------------
214 : !BOP
215 : !
216 : ! !IROUTINE: FileData_Cleanup
217 : !
218 : ! !DESCRIPTION: Subroutine FileData\_Cleanup cleans up the file data object
219 : ! FileDta. If DeepClean is set to False, only the data arrays will be removed.
220 : !\\
221 : !\\
222 : ! !INTERFACE:
223 : !
224 0 : SUBROUTINE FileData_Cleanup( FileDta, DeepClean )
225 : !
226 : ! !INPUT PARAMETERS:
227 : !
228 : TYPE(FileData), POINTER :: FileDta
229 : LOGICAL, INTENT(IN) :: DeepClean
230 : !
231 : ! !REVISION HISTORY:
232 : ! 19 Dec 2013 - C. Keller: Initialization
233 : ! See https://github.com/geoschem/hemco for complete history
234 : !EOP
235 : !------------------------------------------------------------------------------
236 : !BOC
237 : !
238 : ! !LOCAL VARIABLES:
239 : !
240 : INTEGER :: I
241 :
242 : !======================================================================
243 : ! FileData_Cleanup begins here!
244 : !======================================================================
245 0 : IF ( ASSOCIATED( FileDta ) ) THEN
246 :
247 : ! Deallocate data arrays
248 0 : CALL HCO_ArrCleanup( FileDta%V3, DeepClean )
249 0 : CALL HCO_ArrCleanup( FileDta%V2, DeepClean )
250 0 : FileDta%nt = 0
251 :
252 0 : IF ( DeepClean ) THEN
253 0 : FileDta%tIDx => NULL()
254 0 : DEALLOCATE ( FileDta )
255 : FileDta => NULL()
256 : ENDIF
257 : ENDIF
258 :
259 0 : END SUBROUTINE FileData_Cleanup
260 : !EOC
261 : !------------------------------------------------------------------------------
262 : ! Harmonized Emissions Component (HEMCO) !
263 : !------------------------------------------------------------------------------
264 : !BOP
265 : !
266 : ! !IROUTINE: FileData_ArrCheck2D
267 : !
268 : ! !DESCRIPTION: Subroutine FileData\_ArrCheck2D allocates the 2D data array
269 : ! vector of the given file data object if it is not yet allocated. If already
270 : ! allocated, it compares the array dimensions against the passed dimensions.
271 : !\\
272 : !\\
273 : ! !INTERFACE:
274 : !
275 0 : SUBROUTINE FileData_ArrCheck2D( HcoConfig, FileDta, nx, ny, nt, RC )
276 : !
277 : ! !INPUT PARAMETERS:
278 : !
279 : TYPE(ConfigObj),POINTER :: HcoConfig ! HEMCO config object
280 : TYPE(FileData), POINTER :: FileDta ! file data object
281 : INTEGER, INTENT(IN) :: nx ! x-dim
282 : INTEGER, INTENT(IN) :: ny ! y-dim
283 : INTEGER, INTENT(IN) :: nt ! time dim => vector length
284 : !
285 : ! !INPUT/OUTPUT PARAMETERS:
286 : !
287 : INTEGER, INTENT(INOUT) :: RC ! Return code
288 : !
289 : ! !REVISION HISTORY:
290 : ! 20 Apr 2013 - C. Keller - Initial version
291 : ! See https://github.com/geoschem/hemco for complete history
292 : !EOP
293 : !------------------------------------------------------------------------------
294 : !BOC
295 : !
296 : ! !LOCAL VARIABLES:
297 : !
298 : INTEGER :: I, AS
299 : CHARACTER(LEN=255) :: MSG, LOC
300 :
301 : ! ================================================================
302 : ! FileData_ArrCheck2D begins here
303 : ! ================================================================
304 0 : LOC = 'FileData_ArrCheck2D (HCO_FILEDATA_MOD.F90)'
305 :
306 : ! Assume success until otherwise
307 0 : RC = HCO_SUCCESS
308 :
309 : ! Compare dimensions if array already allocated
310 0 : IF ( ASSOCIATED(FileDta%V2) ) THEN
311 : IF ( ( FileDta%nt /= nt ) .OR. &
312 0 : ( SIZE(FileDta%V2(1)%Val,1) /= nx ) .OR. &
313 : ( SIZE(FileDta%V2(1)%Val,2) /= ny ) ) THEN
314 0 : MSG = 'Wrong dimensions: ' // TRIM(FileDta%ncFile)
315 0 : CALL HCO_ERROR ( MSG, RC )
316 : ENDIF
317 0 : RETURN
318 : ENDIF
319 :
320 : ! If not associated yet:
321 : ! Initialize vector and corresponding arrays.
322 0 : CALL FileData_ArrInit ( FileDta, nt, nx, ny, RC )
323 0 : IF ( RC /= HCO_SUCCESS ) THEN
324 0 : CALL HCO_ERROR( 'ERROR 0', RC, THISLOC=LOC )
325 0 : RETURN
326 : ENDIF
327 :
328 : END SUBROUTINE FileData_ArrCheck2D
329 : !EOC
330 : !------------------------------------------------------------------------------
331 : ! Harmonized Emissions Component (HEMCO) !
332 : !------------------------------------------------------------------------------
333 : !BOP
334 : !
335 : ! !IROUTINE: FileData_ArrCheck3D
336 : !
337 : ! !DESCRIPTION: Subroutine FileData\_ArrCheck3D allocates the 3D data array
338 : ! vector of the given file data object if it is not yet allocated. If already
339 : ! allocated, it compares the array dimensions against the passed dimensions.
340 : !\\
341 : !\\
342 : ! !INTERFACE:
343 : !
344 0 : SUBROUTINE FileData_ArrCheck3D( HcoConfig, FileDta, nx, ny, nz, nt, RC )
345 : !
346 : ! !USES:
347 : !
348 : !
349 : ! !INPUT PARAMETERS:
350 : !
351 : TYPE(ConfigObj),POINTER :: HcoConfig ! HEMCO config object
352 : TYPE(FileData), POINTER :: FileDta ! Container
353 : INTEGER, INTENT(IN) :: nx ! x-dim
354 : INTEGER, INTENT(IN) :: ny ! y-dim
355 : INTEGER, INTENT(IN) :: nz ! z-dim
356 : INTEGER, INTENT(IN) :: nt ! Time dim => vector length
357 : !
358 : ! !INPUT/OUTPUT PARAMETERS:
359 : !
360 : INTEGER, INTENT(INOUT) :: RC ! Return code
361 : !
362 : ! !REVISION HISTORY:
363 : ! 20 Apr 2013 - C. Keller - Initial version
364 : ! See https://github.com/geoschem/hemco for complete history
365 : !EOP
366 : !------------------------------------------------------------------------------
367 : !BOC
368 : !
369 : ! !LOCAL VARIABLES:
370 : !
371 : INTEGER :: I, AS
372 : CHARACTER(LEN=255) :: MSG, LOC
373 :
374 : ! ================================================================
375 : ! FileData_ArrCheck3D begins here
376 : ! ================================================================
377 0 : LOC = 'FileData_ArrCheck3D (HCO_FILEDATA_MOD.F90)'
378 :
379 : ! Assume success until otherwise
380 0 : RC = HCO_SUCCESS
381 :
382 : ! Compare dimensions if array already allocated
383 0 : IF ( Associated(FileDta%V3) ) THEN
384 : IF ( ( FileDta%nt /= nt ) .OR. &
385 0 : ( SIZE(FileDta%V3(1)%Val,1) /= nx ) .OR. &
386 0 : ( SIZE(FileDta%V3(1)%Val,2) /= ny ) .OR. &
387 : ( SIZE(FileDta%V3(1)%Val,3) /= nz ) ) THEN
388 0 : MSG = 'Wrong dimensions: ' // TRIM(FileDta%ncFile)
389 0 : CALL HCO_ERROR ( MSG, RC )
390 : ENDIF
391 0 : RETURN
392 : ENDIF
393 :
394 : ! If not associated yet:
395 : ! Initialize vector and corresponding arrays.
396 0 : CALL FileData_ArrInit( FileDta, nt, nx, ny, nz, RC )
397 0 : IF ( RC /= HCO_SUCCESS ) THEN
398 0 : CALL HCO_ERROR( 'ERROR 1', RC, THISLOC=LOC )
399 0 : RETURN
400 : ENDIF
401 :
402 : END SUBROUTINE FileData_ArrCheck3D
403 : !EOC
404 : !------------------------------------------------------------------------------
405 : ! Harmonized Emissions Component (HEMCO) !
406 : !------------------------------------------------------------------------------
407 : !BOP
408 : !
409 : ! !IROUTINE: FileData_ArrIsDefined
410 : !
411 : ! !DESCRIPTION: Function FileData\_ArrIsDefined returns true if the data
412 : ! array of the given file data object is defined.
413 : !\\
414 : !\\
415 : ! !INTERFACE:
416 : !
417 0 : FUNCTION FileData_ArrIsDefined( FileDta ) RESULT( IsDefined )
418 : !
419 : ! !INPUT PARAMETERS:
420 : !
421 : TYPE(FileData), POINTER :: FileDta ! Container
422 : !
423 : ! !RETURN VALUE:
424 : !
425 : LOGICAL :: IsDefined
426 : !
427 : ! !REVISION HISTORY:
428 : ! 20 Apr 2013 - C. Keller - Initial version
429 : ! See https://github.com/geoschem/hemco for complete history
430 : !EOP
431 : !------------------------------------------------------------------------------
432 : !BOC
433 :
434 : ! ================================================================
435 : ! FileData_ArrIsDefined begins here
436 : ! ================================================================
437 :
438 : ! Init
439 0 : IsDefined = .FALSE.
440 :
441 : ! Return here if passed FileDta object is not defined
442 0 : IF ( .NOT. ASSOCIATED( FileDta ) ) RETURN
443 :
444 : ! nt must be larger than zero!
445 0 : IF ( FileDta%nt <= 0 ) Return
446 :
447 : ! 2D array
448 0 : IF ( (FileDta%SpaceDim<=2) .AND. ASSOCIATED(FileDta%V2) ) THEN
449 0 : IsDefined = .TRUE.
450 : ENDIF
451 :
452 : ! 3D array
453 0 : IF ( (FileDta%SpaceDim==3) .AND. ASSOCIATED(FileDta%V3) ) THEN
454 0 : IsDefined = .TRUE.
455 : ENDIF
456 :
457 : END FUNCTION FileData_ArrIsDefined
458 : !EOC
459 : !------------------------------------------------------------------------------
460 : ! Harmonized Emissions Component (HEMCO) !
461 : !------------------------------------------------------------------------------
462 : !BOP
463 : !
464 : ! !IROUTINE: FileData_ArrIsTouched
465 : !
466 : ! !DESCRIPTION: Function FileData\_ArrIsTouched returns true if the data
467 : ! array of the given file data object has already been touched, e.g. if
468 : ! the data has already been read (or at least attempted to being read).
469 : ! This information is mostly important for file data objects that are shared
470 : ! by multiple data containers. See ReadList\_Fill in hco\_readlist\_mod.F90
471 : ! for more details.
472 : !\\
473 : !\\
474 : ! !INTERFACE:
475 : !
476 0 : FUNCTION FileData_ArrIsTouched( FileDta ) RESULT( IsTouched )
477 : !
478 : ! !INPUT PARAMETERS:
479 : !
480 : TYPE(FileData), POINTER :: FileDta ! Container
481 : !
482 : ! !RETURN VALUE:
483 : !
484 : LOGICAL :: IsTouched
485 : !
486 : ! !REVISION HISTORY:
487 : ! 17 Mar 2015 - C. Keller - Initial version
488 : ! See https://github.com/geoschem/hemco for complete history
489 : !EOP
490 : !------------------------------------------------------------------------------
491 : !BOC
492 :
493 : ! ================================================================
494 : ! FileData_ArrIsTouched begins here
495 : ! ================================================================
496 :
497 : ! Init
498 0 : IsTouched = .FALSE.
499 :
500 : ! Return touched flag
501 0 : IF ( ASSOCIATED( FileDta ) ) THEN
502 0 : IsTouched = FileDta%IsTouched
503 : ENDIF
504 :
505 :
506 0 : END FUNCTION FileData_ArrIsTouched
507 : !EOC
508 : !------------------------------------------------------------------------------
509 : ! Harmonized Emissions Component (HEMCO) !
510 : !------------------------------------------------------------------------------
511 : !BOP
512 : !
513 : ! !IROUTINE: FileData_ArrInit2D
514 : !
515 : ! !DESCRIPTION: Subroutine FileData\_ArrInit2D is a wrapper routine
516 : ! to initialize 2D data arrays of a file data object. To ensure proper
517 : ! functioning of the file data object and related routines, this routine
518 : ! should always be used to initialize file data arrays (and NOT HCO\_ArrInit
519 : ! directly!).
520 : !\\
521 : !\\
522 : ! !INTERFACE:
523 : !
524 0 : SUBROUTINE FileData_ArrInit2D( FileDta, nt, nx, ny, RC )
525 : !
526 : ! !USES:
527 : !
528 : !
529 : ! !INPUT PARAMETERS:
530 : !
531 : TYPE(FileData), POINTER :: FileDta ! Container
532 : INTEGER, INTENT(IN) :: nt ! Time dim => vector length
533 : INTEGER, INTENT(IN) :: nx ! x-dim
534 : INTEGER, INTENT(IN) :: ny ! y-dim
535 : !
536 : ! !INPUT/OUTPUT PARAMETERS:
537 : !
538 : INTEGER, INTENT(INOUT) :: RC ! Return code
539 : !
540 : ! !REVISION HISTORY:
541 : ! 01 Oct 2014 - C. Keller - Initial version
542 : ! See https://github.com/geoschem/hemco for complete history
543 : !EOP
544 : !------------------------------------------------------------------------------
545 : !BOC
546 : !
547 : ! !LOCAL VARIABLES:
548 : !
549 : CHARACTER(LEN=255) :: LOC
550 : ! ================================================================
551 : ! FileData_ArrInit2D begins here
552 : ! ================================================================
553 0 : LOC = 'FileData_ArrInit2D (HCO_FILEDATA_MOD.F90)'
554 :
555 : ! Assume success until otherwise
556 0 : RC = HCO_SUCCESS
557 :
558 : ! Initialize vector and corresponding arrays.
559 0 : CALL HCO_ArrInit( FileDta%V2, nt, nx, ny, RC )
560 0 : IF ( RC /= HCO_SUCCESS ) THEN
561 0 : CALL HCO_ERROR( 'ERROR 2', RC, THISLOC=LOC )
562 0 : RETURN
563 : ENDIF
564 :
565 : ! Update nt
566 0 : FileDta%nt = nt
567 :
568 : ! Return w/ success
569 0 : RC = HCO_SUCCESS
570 :
571 : END SUBROUTINE FileData_ArrInit2D
572 : !EOC
573 : !------------------------------------------------------------------------------
574 : ! Harmonized Emissions Component (HEMCO) !
575 : !------------------------------------------------------------------------------
576 : !BOP
577 : !
578 : ! !IROUTINE: FileData_ArrInit3D
579 : !
580 : ! !DESCRIPTION: Subroutine FileData\_ArrInit3D is a wrapper routine
581 : ! to initialize 3D data arrays of a file data object. To ensure proper
582 : ! functioning of the file data object and related routines, this routine
583 : ! should always be used to initialize file data arrays (and NOT HCO\_ArrInit
584 : ! directly!).
585 : !\\
586 : !\\
587 : ! !INTERFACE:
588 : !
589 0 : SUBROUTINE FileData_ArrInit3D( FileDta, nt, nx, ny, nz, RC )
590 : !
591 : ! !USES:
592 : !
593 : !
594 : ! !INPUT PARAMETERS:
595 : !
596 : TYPE(FileData), POINTER :: FileDta ! Container
597 : INTEGER, INTENT(IN) :: nt ! Time dim => vector length
598 : INTEGER, INTENT(IN) :: nx ! x-dim
599 : INTEGER, INTENT(IN) :: ny ! y-dim
600 : INTEGER, INTENT(IN) :: nz ! z-dim
601 : !
602 : ! !INPUT/OUTPUT PARAMETERS:
603 : !
604 : INTEGER, INTENT(INOUT) :: RC ! Return code
605 : !
606 : ! !REVISION HISTORY:
607 : ! 20 Apr 2013 - C. Keller - Initial version
608 : ! See https://github.com/geoschem/hemco for complete history
609 : !EOP
610 : !------------------------------------------------------------------------------
611 : !BOC
612 : !
613 : ! !LOCAL VARIABLES:
614 : !
615 : CHARACTER(LEN=255) :: LOC
616 : ! ================================================================
617 : ! FileData_ArrInit3D begins here
618 : ! ================================================================
619 0 : LOC = 'FileData_ArrInit3D (HCO_FILEDATA_MOD.F90)'
620 :
621 : ! Assume success until otherwise
622 0 : RC = HCO_SUCCESS
623 :
624 : ! Initialize vector and corresponding arrays.
625 0 : CALL HCO_ArrInit( FileDta%V3, nt, nx, ny, nz, RC )
626 0 : IF ( RC /= HCO_SUCCESS ) THEN
627 0 : CALL HCO_ERROR( 'ERROR 3', RC, THISLOC=LOC )
628 0 : RETURN
629 : ENDIF
630 :
631 : ! Update nt
632 0 : FileDta%nt = nt
633 :
634 : ! Return w/ success
635 0 : RC = HCO_SUCCESS
636 :
637 : END SUBROUTINE FileData_ArrInit3D
638 : !EOC
639 : END MODULE HCO_FileData_Mod
|