forked from ESCOMP/CLUBB_CESM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stat_file_module.F90
105 lines (73 loc) · 3.29 KB
/
stat_file_module.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
!-------------------------------------------------------------------------------
! $Id$
!===============================================================================
module stat_file_module
! Description:
! Contains two derived types for describing the contents and location of
! either NetCDF or GrADS files.
!-------------------------------------------------------------------------------
use clubb_precision, only: &
stat_rknd, & ! Variable
time_precision, &
core_rknd
implicit none
public :: variable, stat_file
! These are used in a 2D or 3D host model to output multiple columns
! Set clubb_i and clubb_j according to the column within the host model;
! The indices must not exceed nlon (for i) or nlat (for j).
integer, save, public :: clubb_i = 1, clubb_j = 1
!$omp threadprivate(clubb_i, clubb_j)
private ! Default scope
! Structure to hold the description of a variable
type variable
! Pointer to the array
real(kind=stat_rknd), dimension(:,:,:), pointer :: ptr
character(len = 30) :: name ! Variable name
character(len = 100) :: description ! Variable description
character(len = 20) :: units ! Variable units
integer :: indx ! NetCDF module Id for var / GrADS index
logical :: l_silhs ! If true, we sample this variable once for each SILHS
! sample point per timestep, rather than just once per
! timestep.
end type variable
! Structure to hold the description of a NetCDF output file
! This makes the new code as compatible as possible with the
! GrADS output code
type stat_file
! File information
character(len = 200) :: &
fname, & ! File name without suffix
fdir ! Path where fname resides
integer :: iounit ! This number is used internally by the
! NetCDF module to track the data set, or by
! GrADS to track the actual file unit.
integer :: &
nrecord, & ! Number of records written
ntimes ! Number of times written
logical :: &
l_defined, & ! Whether nf90_enddef() has been called
l_byte_swapped ! Is this a file in the opposite byte ordering?
! NetCDF datafile dimensions indices
integer :: &
LatDimId, LongDimId, AltDimId, TimeDimId, &
LatVarId, LongVarId, AltVarId, TimeVarId
! Grid information
integer :: ia, iz ! Vertical extent
integer :: nlat, nlon ! The number of points in the X and Y
real( kind = core_rknd ), dimension(:), allocatable :: &
z ! Height of vertical levels [m]
! Time information
integer :: day, month, year ! Date of starting time
real( kind = core_rknd ), dimension(:), allocatable :: &
rlat, & ! Latitude [Degrees N]
rlon ! Longitude [Degrees E]
real( kind = core_rknd ) :: &
dtwrite ! Interval between output [Seconds]
real( kind = time_precision ) :: &
time ! Start time [Seconds]
! Statistical Variables
integer :: nvar ! Number of variables for this file
type (variable), dimension(:), allocatable :: &
var ! List and variable description
end type stat_file
end module stat_file_module