-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnctablemd.ftn90
357 lines (352 loc) · 20.2 KB
/
nctablemd.ftn90
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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
module nctablemd
!/ ------------------------------------------------------------------- /
!/
!/
!/ 08-dec-2009 : initial revision (sander.hulst@bmtargoss.com)
!/
!/ copyright 2009 bmtargoss
!/ no unauthorized use without permission.
!/
! 1. purpose :
!
! nctable is a support module for agioncmd. it defines the supported
! netcdf variables
!
! 2.attributes
! --name-------------type-------description-----------------------
! nctable ncttype struct array with fields
! %standard_name char see remarks a
! %long_name char "
! %units char "
! %nctype integer nc_short, nc_byte etc.
! %datamin real minimum expected data value
! %datamax real maximum expected data value
! %varid int nc90_var_id
use netcdf
implicit none
private
public :: nctable, nctable_record
public :: get_nctable_record, set_nctable_convention_nautical
public :: pi
real, parameter :: pi = 3.1415927
real, parameter :: r2d = 180. / pi
real, parameter :: d2r = pi / 180.
integer, parameter :: variddum = -1
logical :: nautical = .true.
type nctable_record
character(128) :: name, standard_name
character(128) :: long_name
character(24) :: units
integer :: nctype
real :: datamin, datamax
integer :: varid
end type nctable_record
type (nctable_record) :: nctable(66)
data nctable(1) / nctable_record("depth",&
"sea_floor_depth_below_sea_level",&
"depth below mean sea level", &
"m", NF90_FLOAT, 0, 0, variddum) /, &
nctable(2) / nctable_record("xcur",&
"eastward_sea_water_velocity",&
"x component of current", &
"m s-1", NF90_SHORT, -20., 20., variddum) /, &
nctable(3) / nctable_record("ycur",&
"northward_sea_water_velocity",&
"y component of current", &
"m s-1", NF90_SHORT, -20., 20., variddum) /, &
nctable(4) / nctable_record("xwnd",&
"eastward_wind",&
"U-Component of Wind", &
"m s-1", NF90_SHORT, -100., 100., variddum) /, &
nctable(5) / nctable_record("ywnd",&
"northward_wind",&
"V-Component of Wind", &
"m s-1", NF90_SHORT, -100., 100., variddum) /, &
nctable(6) / nctable_record("astd",&
"none",&
"air sea temperature difference (k)", &
"k", NF90_BYTE, 0, 0, variddum) /, &
nctable(7) / nctable_record("ustar",&
"none",&
"friction velocity", &
"m s-1", NF90_SHORT, 0, 20, variddum) /,&
nctable(8) / nctable_record("hs",&
"sea_surface_wave_significant_height",&
"hs", &
"m", NF90_SHORT, 0., 50., variddum) /, &
nctable(9) / nctable_record("L",&
"none",&
"average wave length", &
"m", NF90_SHORT, 0., 1000., variddum) /, &
nctable(10) / nctable_record("theta0",&
"sea_surface_wave_from_direction",&
"theta0", &
"degrees", NF90_SHORT, 0., 360., variddum) /, &
nctable(11) / nctable_record("tmm10",&
"sea_surface_wave_mean_period_from_variance_spectral_density_inverse_frequency_moment",&
"tm-10", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(12) / nctable_record("thetam",&
"none",&
"thetam", &
"degrees", NF90_BYTE, 0, 0, variddum) /, &
nctable(13) / nctable_record("tp",&
"none",&
"tp", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(14) / nctable_record("thetap",&
"none",&
"thetap", &
"degrees", NF90_SHORT, 0., 360., variddum) /,&
nctable(15) / nctable_record("fpl",&
"none",&
"peak frequency of wind sea part of spectrum", &
"s-1", NF90_BYTE, 0., 10., variddum) /,&
nctable(16) / nctable_record("dpl",&
"none",&
"direction of peak frequency of wind sea part of spectrum", &
"degrees", NF90_BYTE, 0., 360., variddum) /,&
nctable(17) / nctable_record("sign_wave_height_partitions",&
"none",&
"hs of partitions. does this mean that i have an extra dimension???", &
"m", NF90_SHORT, 0., 30., variddum) /, &
nctable(18) / nctable_record("tp_partitions",&
"none",&
"relative peak periods of partitions of the spectrum", &
"s", NF90_BYTE, 0., 24., variddum) /,&
nctable(19) / nctable_record("tp_length_partitions",&
"none",&
"peak wave lengths of partitions of the spectrum", &
"s", NF90_SHORT, 0, 0, variddum) /,&
nctable(20) / nctable_record("theta0_partitions",&
"none",&
"mean wave direction of partitions of spectrum", &
"degrees", NF90_BYTE, 0., 360., variddum) /,&
nctable(21) / nctable_record("spread_partitions",&
"none",&
"directional spread of partition of spectrum cf", &
"degrees", NF90_BYTE, 0, 81, variddum) /, &
nctable(22) / nctable_record("wind_sea_fraction_partitions",&
"none",&
"wind sea fraction of partitions of spectrum", &
"1", NF90_SHORT, 0., 1., variddum) /,&
nctable(23) / nctable_record("wind_sea_fraction",&
"none",&
"wind sea fraction of entire spectrum", &
"1", NF90_SHORT, 0., 1., variddum) /,&
nctable(24) / nctable_record("npartitions",&
"none",&
"number of partitions found in spectrum", &
"1", NF90_BYTE, 0, 0, variddum) /,&
nctable(25) / nctable_record("source_term_timestep",&
"none",&
"average timestep in the source term integration", &
"s", NF90_SHORT, 0, 0, variddum) /,&
nctable(26) / nctable_record("cut_off_frequency",&
"none",&
"cut-off frequency", &
"s-1", NF90_SHORT, 0., 40., variddum) /,&
nctable(27) / nctable_record("icec",&
"sea_ice_area_fraction",&
"ice cover", &
"1", NF90_BYTE, 0., 1., variddum) /,&
nctable(28) / nctable_record("ssh",&
"sea_surface_height",&
"SSH", &
"m", NF90_SHORT, -15., 15., variddum) /, &
nctable(29) / nctable_record("landmask",&
"land_binary_mask",&
"land cover (1=land, 0=sea)", &
"m", nf90_byte, 0, 0, variddum) /, &
nctable(30) / nctable_record("tm02",&
"sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment", &
"tm02", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(31) / nctable_record("tm01",&
"sea_surface_wave_mean_period_from_variance_spectral_density_first_frequency_moment", &
"tm01", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(32) / nctable_record("tps",&
"none",&
"tps", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(33) / nctable_record("spread",&
"none",&
"directional spreading", &
"degrees", NF90_SHORT, 0., 360., variddum) /, &
nctable(34) / nctable_record("rtm01",&
"none", &
"rtm01", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(35) / nctable_record("hswe",&
"sea_surface_swell_wave_significant_height",&
"wave height of swell part", &
"m", NF90_SHORT, 0., 50., variddum) /, &
nctable(36) / nctable_record("rtmm10",&
"none",&
"rtm-10", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(37) / nctable_record("botl",&
"none",&
"depth below still water level", &
"m", NF90_FLOAT, 0, 0, variddum) /, &
nctable(38) / nctable_record("ubot",&
"none",&
"orbital velocity near bottom", &
"m s-1", NF90_SHORT, 0, 15, variddum) /, &
nctable(39) / nctable_record("urms",&
"none",&
"rms of orbital velocity near bottom", &
"m s-1", NF90_SHORT, 0, 5, variddum) /, &
nctable(40) / nctable_record("dhs",&
"none",&
"dHs", &
"m", NF90_SHORT, 0, 25, variddum) /, &
nctable(41) / nctable_record("dtm",&
"none",&
"dTm", &
"s", NF90_SHORT, 0, 25, variddum) /, &
nctable(42) / nctable_record("cdrag",&
"none",&
"Cdrag", &
"1", NF90_SHORT, 0., 20., variddum) /, &
nctable(43) / nctable_record("phs0",&
"sea_surface_wind_wave_significant_height",&
"sea surface wind wave significant height", &
"m", NF90_SHORT, 0., 50., variddum) /, &
nctable(44) / nctable_record("phs1",&
"sea_surface_primary_swell_wave_significant_height",&
"sea surface primary_swell wave significant height", &
"m", NF90_SHORT, 0., 50., variddum) /, &
nctable(45) / nctable_record("phs2",&
"sea_surface_secondary_swell_wave_significant_height",&
"sea surface secondary_swell wave significant height", &
"m", NF90_SHORT, 0., 50., variddum) /, &
nctable(46) / nctable_record("phs3",&
"sea_surface_tertiary_swell_wave_significant_height",&
"sea surface tertiary_swell wave significant height", &
"m", NF90_SHORT, 0., 50., variddum) /, &
nctable(47) / nctable_record("phs4",&
"sea_surface_quaternary_swell_wave_significant_height",&
"sea surface quaternary_swell wave significant height", &
"m", NF90_SHORT, 0., 50., variddum) /, &
nctable(48) / nctable_record("phs5",&
"sea_surface_quinary_swell_wave_significant_height",&
"sea surface quinary_swell wave significant height", &
"m", NF90_SHORT, 0., 50., variddum) /, &
nctable(49) / nctable_record("ptp0",&
"sea_surface_wind_wave_period_at_variance_spectral_density_maximum",&
"sea surface wind wave period at variance spectral density maximum", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(50) / nctable_record("ptp1",&
"sea_surface_primary_swell_wave_period_at_variance_spectral_density_maximum",&
"sea surface primary swell wave period at variance spectral density maximum", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(51) / nctable_record("ptp2",&
"sea_surface_secondary_swell_wave_period_at_variance_spectral_density_maximum",&
"sea surface secondary swell wave period at variance spectral density maximum", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(52) / nctable_record("ptp3",&
"sea_surface_tertiary_swell_wave_period_at_variance_spectral_density_maximum",&
"sea surface tertiary swell wave period at variance spectral density maximum", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(53) / nctable_record("ptp4",&
"sea_surface_quaternary_swell_wave_period_at_variance_spectral_density_maximum",&
"sea surface quaternary swell wave period at variance spectral density maximum", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(54) / nctable_record("ptp5",&
"sea_surface_quinary_swell_wave_period_at_variance_spectral_density_maximum",&
"sea surface quinary swell wave period at variance spectral density maximum", &
"s", NF90_SHORT, 0., 50., variddum) /, &
nctable(55) / nctable_record("pdir0",&
"sea_surface_wind_wave_mean_from_direction",&
"sea surface wind wave mean from direction", &
"degree", NF90_SHORT, 0., 360., variddum) /, &
nctable(56) / nctable_record("pdir1",&
"sea_surface_primary_swell_wave_mean_from_direction",&
"sea surface primary swell wave mean from direction", &
"degree", NF90_SHORT, 0., 360., variddum) /, &
nctable(57) / nctable_record("pdir2",&
"sea_surface_secondary_swell_wave_mean_from_direction",&
"sea surface secondary swell wave mean from direction", &
"degree", NF90_SHORT, 0., 360., variddum) /, &
nctable(58) / nctable_record("pdir3",&
"sea_surface_tertiary_swell_wave_mean_from_direction",&
"sea surface tertiary swell wave mean from direction", &
"degree", NF90_SHORT, 0., 360., variddum) /, &
nctable(59) / nctable_record("pdir4",&
"sea_surface_quaternary_swell_wave_mean_from_direction",&
"sea surface quaternary swell wave mean from direction", &
"degree", NF90_SHORT, 0., 360., variddum) /, &
nctable(60) / nctable_record("pdir5",&
"sea_surface_quinary_swell_wave_mean_from_direction",&
"sea surface quinary swell wave mean from direction", &
"degree", NF90_SHORT, 0., 360., variddum) /, &
nctable(61) / nctable_record("pspr0",&
"none",&
"directional spread of partition", &
"degree", NF90_SHORT, 0., 81., variddum) /, &
nctable(62) / nctable_record("pspr1",&
"none",&
"directional spread of partition", &
"degree", NF90_SHORT, 0., 81., variddum) /, &
nctable(63) / nctable_record("pspr2",&
"none",&
"directional spread of partition", &
"degree", NF90_SHORT, 0., 81., variddum) /, &
nctable(64) / nctable_record("pspr3",&
"none",&
"directional spread of partition", &
"degree", NF90_SHORT, 0., 81., variddum) /, &
nctable(65) / nctable_record("pspr4",&
"none",&
"directional spread of partition", &
"degree", NF90_SHORT, 0., 81., variddum) /, &
nctable(66) / nctable_record("pspr5",&
"none",&
"directional spread of partition", &
"degree", NF90_SHORT, 0., 81., variddum) /
contains
subroutine get_nctable_record(varname, trecord, found)
character(len=*), intent( in) :: varname
type(nctable_record), intent(out) :: trecord
logical, optional, intent(out) :: found
character(128) :: tmpname
integer :: i
if ( present(found) ) found = .false.
do i=1,size(nctable)
if ( nctable(i)%name == varname ) then
trecord = nctable(i)
if ( .not.nautical ) then
tmpname = trecord%standard_name
call nautical_to_cartesian_name(tmpname, trecord%standard_name)
end if
if ( present(found) ) found = .true.
return
end if
end do
if ( i > size(nctable) ) then
print "(A)", "Could not find ", trim(varname), " in record table"
end if
end subroutine get_nctable_record
subroutine set_nctable_convention_nautical(isnautical)
logical, intent( in) :: isnautical
nautical = isnautical
end subroutine set_nctable_convention_nautical
subroutine nautical_to_cartesian_name(nname, cname)
character(128), intent( in) :: nname
character(128), intent(out) :: cname
integer :: i
character(20) :: search = 'from_direction'
i = index(nname, trim(search))
if ( i < 1 ) then
cname = nname
else
if ( i+len(trim(search)) < len(trim(nname)) ) then
cname = nname(1:i-1) // 'to_direction' // nname(i+len(trim(search)):len(trim(nname)))
else
cname = nname(1:i-1) // 'to_direction'
end if
end if
end subroutine nautical_to_cartesian_name
end module nctablemd