-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdensity.txt
672 lines (601 loc) · 23.1 KB
/
density.txt
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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
Calculating Density Using Python GSW Package
============================================
Steven K. Baum
v0.5, 2013-02-18
:doctype: book
:toc:
:icons:
:numbered!:
[preface]
Summary
-------
This documents how density fields were calculated from salinity and
temperature fields in a set of NetCDF files created by an ocean
simulation using the ROMS model.
Python Software
---------------
The Python software package +gsw+ can be found at:
https://pypi.python.org/pypi/gsw/[+https://pypi.python.org/pypi/gsw/+]
and contains an implementation of the Thermodynamic Equation Of
Seawater 2010 (TEOS-10), more about which can be found at:
http://www.teos-10.org/[+http://www.teos-10.org/+]
The *Numpy* package is a prerequisite and can be found at:
http://www.scipy.org/[+http://www.scipy.org/+]
The *netcdf4-python* package is also needed and can be found at:
https://code.google.com/p/netcdf4-python/[+https://code.google.com/p/netcdf4-python/+]
Once the prerequisites have been installed and the package is downloaded it can be installed in the usual
Pythonic way:
-----
tar xzvf gsw-3.0.2.tar.gz
cd gsw-3.0.2
python setup.py build
su
python setup.py install
-----
Original Files
--------------
The original files have the name structure +ocean_his_****.nc+ and
are presently located in the +barataria+ subdirectory:
-----
/raid/zrong/data2North
-----
NetCDF Header
~~~~~~~~~~~~~
The NetCDF header for the file +ocean_his_0001.nc+ is:
-----
netcdf ocean_his_0001 {
dimensions:
xi_rho = 671 ;
xi_u = 670 ;
xi_v = 671 ;
xi_psi = 670 ;
eta_rho = 191 ;
eta_u = 191 ;
eta_v = 190 ;
eta_psi = 190 ;
N = 30 ;
s_rho = 30 ;
s_w = 31 ;
tracer = 6 ;
boundary = 4 ;
ocean_time = UNLIMITED ; // (101 currently)
variables:
int ntimes ;
ntimes:long_name = "number of long time-steps" ;
int ndtfast ;
ndtfast:long_name = "number of short time-steps" ;
double dt ;
dt:long_name = "size of long time-steps" ;
dt:units = "second" ;
double dtfast ;
dtfast:long_name = "size of short time-steps" ;
dtfast:units = "second" ;
double dstart ;
dstart:long_name = "time stamp assigned to model initilization" ;
dstart:units = "days since 1970-01-01 00:00:00" ;
int nHIS ;
nHIS:long_name = "number of time-steps between history records" ;
int ndefHIS ;
ndefHIS:long_name = "number of time-steps between the creation of history files" ;
int nRST ;
nRST:long_name = "number of time-steps between restart records" ;
nRST:cycle = "only latest two records are maintained" ;
int ntsDIA ;
ntsDIA:long_name = "starting time-step for accumulation of diagnostic fields" ;
int nDIA ;
nDIA:long_name = "number of time-steps between diagnostic records" ;
int ndefDIA ;
ndefDIA:long_name = "number of time-steps between the creation of diagnostic files" ;
double Falpha ;
Falpha:long_name = "Power-law shape barotropic filter parameter" ;
double Fbeta ;
Fbeta:long_name = "Power-law shape barotropic filter parameter" ;
double Fgamma ;
Fgamma:long_name = "Power-law shape barotropic filter parameter" ;
double nl_tnu2(tracer) ;
nl_tnu2:long_name = "nonlinear model Laplacian mixing coefficient for tracers" ;
nl_tnu2:units = "meter2 second-1" ;
double nl_visc2 ;
nl_visc2:long_name = "nonlinear model Laplacian mixing coefficient for momentum" ;
nl_visc2:units = "meter2 second-1" ;
double Akt_bak(tracer) ;
Akt_bak:long_name = "background vertical mixing coefficient for tracers" ;
Akt_bak:units = "meter2 second-1" ;
double Akv_bak ;
Akv_bak:long_name = "background vertical mixing coefficient for momentum" ;
Akv_bak:units = "meter2 second-1" ;
double Akk_bak ;
Akk_bak:long_name = "background vertical mixing coefficient for turbulent energy" ;
Akk_bak:units = "meter2 second-1" ;
double Akp_bak ;
Akp_bak:long_name = "background vertical mixing coefficient for length scale" ;
Akp_bak:units = "meter2 second-1" ;
double rdrg ;
rdrg:long_name = "linear drag coefficient" ;
rdrg:units = "meter second-1" ;
double rdrg2 ;
rdrg2:long_name = "quadratic drag coefficient" ;
double Zob ;
Zob:long_name = "bottom roughness" ;
Zob:units = "meter" ;
double Zos ;
Zos:long_name = "surface roughness" ;
Zos:units = "meter" ;
double Znudg ;
Znudg:long_name = "free-surface nudging/relaxation inverse time scale" ;
Znudg:units = "day-1" ;
double M2nudg ;
M2nudg:long_name = "2D momentum nudging/relaxation inverse time scale" ;
M2nudg:units = "day-1" ;
double M3nudg ;
M3nudg:long_name = "3D momentum nudging/relaxation inverse time scale" ;
M3nudg:units = "day-1" ;
double Tnudg(tracer) ;
Tnudg:long_name = "Tracers nudging/relaxation inverse time scale" ;
Tnudg:units = "day-1" ;
double FSobc_in(boundary) ;
FSobc_in:long_name = "free-surface inflow, nudging inverse time scale" ;
FSobc_in:units = "second-1" ;
double FSobc_out(boundary) ;
FSobc_out:long_name = "free-surface outflow, nudging inverse time scale" ;
FSobc_out:units = "second-1" ;
double M2obc_in(boundary) ;
M2obc_in:long_name = "2D momentum inflow, nudging inverse time scale" ;
M2obc_in:units = "second-1" ;
double M2obc_out(boundary) ;
M2obc_out:long_name = "2D momentum outflow, nudging inverse time scale" ;
M2obc_out:units = "second-1" ;
double Tobc_in(boundary, tracer) ;
Tobc_in:long_name = "tracers inflow, nudging inverse time scale" ;
Tobc_in:units = "second-1" ;
double Tobc_out(boundary, tracer) ;
Tobc_out:long_name = "tracers outflow, nudging inverse time scale" ;
Tobc_out:units = "second-1" ;
double M3obc_in(boundary) ;
M3obc_in:long_name = "3D momentum inflow, nudging inverse time scale" ;
M3obc_in:units = "second-1" ;
double M3obc_out(boundary) ;
M3obc_out:long_name = "3D momentum outflow, nudging inverse time scale" ;
M3obc_out:units = "second-1" ;
double rho0 ;
rho0:long_name = "mean density used in Boussinesq approximation" ;
rho0:units = "kilogram meter-3" ;
double gamma2 ;
gamma2:long_name = "slipperiness parameter" ;
int LtracerSrc(tracer) ;
LtracerSrc:long_name = "tracer point sources and sink activation switch" ;
LtracerSrc:flag_values = 0, 1 ;
LtracerSrc:flag_meanings = ".FALSE. .TRUE." ;
int spherical ;
spherical:long_name = "grid type logical switch" ;
spherical:flag_values = 0, 1 ;
spherical:flag_meanings = "Cartesian spherical" ;
double xl ;
xl:long_name = "domain length in the XI-direction" ;
xl:units = "meter" ;
double el ;
el:long_name = "domain length in the ETA-direction" ;
el:units = "meter" ;
int Vtransform ;
Vtransform:long_name = "vertical terrain-following transformation equation" ;
int Vstretching ;
Vstretching:long_name = "vertical terrain-following stretching function" ;
double theta_s ;
theta_s:long_name = "S-coordinate surface control parameter" ;
double theta_b ;
theta_b:long_name = "S-coordinate bottom control parameter" ;
double Tcline ;
Tcline:long_name = "S-coordinate surface/bottom layer width" ;
Tcline:units = "meter" ;
double hc ;
hc:long_name = "S-coordinate parameter, critical depth" ;
hc:units = "meter" ;
double s_rho(s_rho) ;
s_rho:long_name = "S-coordinate at RHO-points" ;
s_rho:valid_min = -1. ;
s_rho:valid_max = 0. ;
s_rho:positive = "up" ;
s_rho:standard_name = "ocean_s_coordinate_g1" ;
s_rho:formula_terms = "s: s_rho C: Cs_r eta: zeta depth: h depth_c: hc" ;
s_rho:field = "s_rho, scalar" ;
double s_w(s_w) ;
s_w:long_name = "S-coordinate at W-points" ;
s_w:valid_min = -1. ;
s_w:valid_max = 0. ;
s_w:positive = "up" ;
s_w:standard_name = "ocean_s_coordinate_g1" ;
s_w:formula_terms = "s: s_w C: Cs_w eta: zeta depth: h depth_c: hc" ;
s_w:field = "s_w, scalar" ;
double Cs_r(s_rho) ;
Cs_r:long_name = "S-coordinate stretching curves at RHO-points" ;
Cs_r:valid_min = -1. ;
Cs_r:valid_max = 0. ;
Cs_r:field = "Cs_r, scalar" ;
double Cs_w(s_w) ;
Cs_w:long_name = "S-coordinate stretching curves at W-points" ;
Cs_w:valid_min = -1. ;
Cs_w:valid_max = 0. ;
Cs_w:field = "Cs_w, scalar" ;
double h(eta_rho, xi_rho) ;
h:long_name = "bathymetry at RHO-points" ;
h:units = "meter" ;
h:coordinates = "x_rho y_rho" ;
h:field = "bath, scalar" ;
double f(eta_rho, xi_rho) ;
f:long_name = "Coriolis parameter at RHO-points" ;
f:units = "second-1" ;
f:coordinates = "x_rho y_rho" ;
f:field = "coriolis, scalar" ;
double pm(eta_rho, xi_rho) ;
pm:long_name = "curvilinear coordinate metric in XI" ;
pm:units = "meter-1" ;
pm:coordinates = "x_rho y_rho" ;
pm:field = "pm, scalar" ;
double pn(eta_rho, xi_rho) ;
pn:long_name = "curvilinear coordinate metric in ETA" ;
pn:units = "meter-1" ;
pn:coordinates = "x_rho y_rho" ;
pn:field = "pn, scalar" ;
double x_rho(eta_rho, xi_rho) ;
x_rho:long_name = "x-locations of RHO-points" ;
x_rho:units = "meter" ;
x_rho:field = "x_rho, scalar" ;
double y_rho(eta_rho, xi_rho) ;
y_rho:long_name = "y-locations of RHO-points" ;
y_rho:units = "meter" ;
y_rho:field = "y_rho, scalar" ;
double x_u(eta_u, xi_u) ;
x_u:long_name = "x-locations of U-points" ;
x_u:units = "meter" ;
x_u:field = "x_u, scalar" ;
double y_u(eta_u, xi_u) ;
y_u:long_name = "y-locations of U-points" ;
y_u:units = "meter" ;
y_u:field = "y_u, scalar" ;
double x_v(eta_v, xi_v) ;
x_v:long_name = "x-locations of V-points" ;
x_v:units = "meter" ;
x_v:field = "x_v, scalar" ;
double y_v(eta_v, xi_v) ;
y_v:long_name = "y-locations of V-points" ;
y_v:units = "meter" ;
y_v:field = "y_v, scalar" ;
double x_psi(eta_psi, xi_psi) ;
x_psi:long_name = "x-locations of PSI-points" ;
x_psi:units = "meter" ;
x_psi:field = "x_psi, scalar" ;
double y_psi(eta_psi, xi_psi) ;
y_psi:long_name = "y-locations of PSI-points" ;
y_psi:units = "meter" ;
y_psi:field = "y_psi, scalar" ;
double angle(eta_rho, xi_rho) ;
angle:long_name = "angle between XI-axis and EAST" ;
angle:units = "radians" ;
angle:coordinates = "x_rho y_rho" ;
angle:field = "angle, scalar" ;
double mask_rho(eta_rho, xi_rho) ;
mask_rho:long_name = "mask on RHO-points" ;
mask_rho:flag_values = 0., 1. ;
mask_rho:flag_meanings = "land water" ;
mask_rho:coordinates = "x_rho y_rho" ;
double mask_u(eta_u, xi_u) ;
mask_u:long_name = "mask on U-points" ;
mask_u:flag_values = 0., 1. ;
mask_u:flag_meanings = "land water" ;
mask_u:coordinates = "x_u y_u" ;
double mask_v(eta_v, xi_v) ;
mask_v:long_name = "mask on V-points" ;
mask_v:flag_values = 0., 1. ;
mask_v:flag_meanings = "land water" ;
mask_v:coordinates = "x_v y_v" ;
double mask_psi(eta_psi, xi_psi) ;
mask_psi:long_name = "mask on psi-points" ;
mask_psi:flag_values = 0., 1. ;
mask_psi:flag_meanings = "land water" ;
mask_psi:coordinates = "x_psi y_psi" ;
double ocean_time(ocean_time) ;
ocean_time:long_name = "time since initialization" ;
ocean_time:units = "seconds since 1970-01-01 00:00:00" ;
ocean_time:calendar = "gregorian" ;
ocean_time:field = "time, scalar, series" ;
float zeta(ocean_time, eta_rho, xi_rho) ;
zeta:long_name = "free-surface" ;
zeta:units = "meter" ;
zeta:time = "ocean_time" ;
zeta:coordinates = "x_rho y_rho ocean_time" ;
zeta:field = "free-surface, scalar, series" ;
zeta:_FillValue = 1.e+37f ;
float ubar(ocean_time, eta_u, xi_u) ;
ubar:long_name = "vertically integrated u-momentum component" ;
ubar:units = "meter second-1" ;
ubar:time = "ocean_time" ;
ubar:coordinates = "x_u y_u ocean_time" ;
ubar:field = "ubar-velocity, scalar, series" ;
ubar:_FillValue = 1.e+37f ;
float vbar(ocean_time, eta_v, xi_v) ;
vbar:long_name = "vertically integrated v-momentum component" ;
vbar:units = "meter second-1" ;
vbar:time = "ocean_time" ;
vbar:coordinates = "x_v y_v ocean_time" ;
vbar:field = "vbar-velocity, scalar, series" ;
vbar:_FillValue = 1.e+37f ;
float u(ocean_time, s_rho, eta_u, xi_u) ;
u:long_name = "u-momentum component" ;
u:units = "meter second-1" ;
u:time = "ocean_time" ;
u:coordinates = "x_u y_u s_rho ocean_time" ;
u:field = "u-velocity, scalar, series" ;
u:_FillValue = 1.e+37f ;
float v(ocean_time, s_rho, eta_v, xi_v) ;
v:long_name = "v-momentum component" ;
v:units = "meter second-1" ;
v:time = "ocean_time" ;
v:coordinates = "x_v y_v s_rho ocean_time" ;
v:field = "v-velocity, scalar, series" ;
v:_FillValue = 1.e+37f ;
float w(ocean_time, s_w, eta_rho, xi_rho) ;
w:long_name = "vertical momentum component" ;
w:units = "meter second-1" ;
w:time = "ocean_time" ;
w:coordinates = "x_rho y_rho s_w ocean_time" ;
w:field = "w-velocity, scalar, series" ;
w:_FillValue = 1.e+37f ;
float temp(ocean_time, s_rho, eta_rho, xi_rho) ;
temp:long_name = "potential temperature" ;
temp:units = "Celsius" ;
temp:time = "ocean_time" ;
temp:coordinates = "x_rho y_rho s_rho ocean_time" ;
temp:field = "temperature, scalar, series" ;
temp:_FillValue = 1.e+37f ;
float salt(ocean_time, s_rho, eta_rho, xi_rho) ;
salt:long_name = "salinity" ;
salt:time = "ocean_time" ;
salt:coordinates = "x_rho y_rho s_rho ocean_time" ;
salt:field = "salinity, scalar, series" ;
salt:_FillValue = 1.e+37f ;
float dye_01(ocean_time, s_rho, eta_rho, xi_rho) ;
dye_01:long_name = "dye concentration, type 01" ;
dye_01:units = "kilogram meter-3" ;
dye_01:time = "ocean_time" ;
dye_01:coordinates = "x_rho y_rho s_rho ocean_time" ;
dye_01:field = "dye_01, scalar, series" ;
dye_01:_FillValue = 1.e+37f ;
float dye_02(ocean_time, s_rho, eta_rho, xi_rho) ;
dye_02:long_name = "dye concentration, type 02" ;
dye_02:units = "kilogram meter-3" ;
dye_02:time = "ocean_time" ;
dye_02:coordinates = "x_rho y_rho s_rho ocean_time" ;
dye_02:field = "dye_02, scalar, series" ;
dye_02:_FillValue = 1.e+37f ;
float dye_03(ocean_time, s_rho, eta_rho, xi_rho) ;
dye_03:long_name = "dye concentration, type 03" ;
dye_03:units = "kilogram meter-3" ;
dye_03:time = "ocean_time" ;
dye_03:coordinates = "x_rho y_rho s_rho ocean_time" ;
dye_03:field = "dye_03, scalar, series" ;
dye_03:_FillValue = 1.e+37f ;
float dye_04(ocean_time, s_rho, eta_rho, xi_rho) ;
dye_04:long_name = "dye concentration, type 04" ;
dye_04:units = "kilogram meter-3" ;
dye_04:time = "ocean_time" ;
dye_04:coordinates = "x_rho y_rho s_rho ocean_time" ;
dye_04:field = "dye_04, scalar, series" ;
dye_04:_FillValue = 1.e+37f ;
float AKv(ocean_time, s_w, eta_rho, xi_rho) ;
AKv:long_name = "vertical viscosity coefficient" ;
AKv:units = "meter2 second-1" ;
AKv:time = "ocean_time" ;
AKv:coordinates = "x_rho y_rho s_w ocean_time" ;
AKv:field = "AKv, scalar, series" ;
float AKt(ocean_time, s_w, eta_rho, xi_rho) ;
AKt:long_name = "temperature vertical diffusion coefficient" ;
AKt:units = "meter2 second-1" ;
AKt:time = "ocean_time" ;
AKt:coordinates = "x_rho y_rho s_w ocean_time" ;
AKt:field = "AKt, scalar, series" ;
float AKs(ocean_time, s_w, eta_rho, xi_rho) ;
AKs:long_name = "salinity vertical diffusion coefficient" ;
AKs:units = "meter2 second-1" ;
AKs:time = "ocean_time" ;
AKs:coordinates = "x_rho y_rho s_w ocean_time" ;
AKs:field = "AKs, scalar, series" ;
float sustr(ocean_time, eta_u, xi_u) ;
sustr:long_name = "surface u-momentum stress" ;
sustr:units = "newton meter-2" ;
sustr:time = "ocean_time" ;
sustr:coordinates = "x_u y_u ocean_time" ;
sustr:field = "surface u-momentum stress, scalar, series" ;
sustr:_FillValue = 1.e+37f ;
float svstr(ocean_time, eta_v, xi_v) ;
svstr:long_name = "surface v-momentum stress" ;
svstr:units = "newton meter-2" ;
svstr:time = "ocean_time" ;
svstr:coordinates = "x_v y_v ocean_time" ;
svstr:field = "surface v-momentum stress, scalar, series" ;
svstr:_FillValue = 1.e+37f ;
float bustr(ocean_time, eta_u, xi_u) ;
bustr:long_name = "bottom u-momentum stress" ;
bustr:units = "newton meter-2" ;
bustr:time = "ocean_time" ;
bustr:coordinates = "x_u y_u ocean_time" ;
bustr:field = "bottom u-momentum stress, scalar, series" ;
bustr:_FillValue = 1.e+37f ;
float bvstr(ocean_time, eta_v, xi_v) ;
bvstr:long_name = "bottom v-momentum stress" ;
bvstr:units = "newton meter-2" ;
bvstr:time = "ocean_time" ;
bvstr:coordinates = "x_v y_v ocean_time" ;
bvstr:field = "bottom v-momentum stress, scalar, series" ;
bvstr:_FillValue = 1.e+37f ;
// global attributes:
:file = "ocean_his_0001.nc" ;
:format = "netCDF-3 classic file" ;
:Conventions = "CF-1.4" ;
:type = "ROMS/TOMS history file" ;
:title = "Texas and Louisiana Shelf case (Nesting)" ;
:rst_file = "ocean_rst.nc" ;
:his_base = "ocean_his" ;
:dia_base = "ocean_dia" ;
:grd_file = "txla_grd_v4_new.nc" ;
:ini_file = "txla_ini_20100401.nc" ;
:frc_file_01 = "/scratch/zhangxq/projects/MayJune2010/txla_blk_narr_2010.nc" ;
:frc_file_02 = "TXLA_river_4dyes_2012.nc" ;
:frc_file_03 = "txla_flx_frc_9913.nc" ;
:frc_file_04 = "txla_grd_v4new_tide_20100401.nc" ;
:bry_file = "/scratch/zhangxq/projects/MayJune2010/txla_bry_2010_new.nc" ;
:clm_file = "/scratch/zhangxq/projects/MayJune2010/txla_clm_2010_new.nc" ;
:script_file = "External/ocean_txla.in" ;
:svn_url = "https://www.myroms.org/svn/src/trunk" ;
:svn_rev = "exported" ;
:code_dir = "/scratch/zhangxq/ROMS" ;
:header_dir = "/scratch/zhangxq/projects/txla_nesting6" ;
:header_file = "txla.h" ;
:os = "Linux" ;
:cpu = "x86_64" ;
:compiler_system = "ifort" ;
:compiler_command = "/g/software/openmpi/1.4.3/intel/bin/mpif90" ;
:compiler_flags = "-heap-arrays -fp-model precise -assume 2underscores -convert big_endian -ip -O3 -free" ;
:tiling = "016x032" ;
:history = "ROMS/TOMS, Version 3.4, Saturday - June 22, 2013 - 10:05:09 PM" ;
:ana_file = "/scratch/zhangxq/projects/txla_nesting6/Functionals/ana_btflux.h, /scratch/zhangxq/projects/txla_nesting6/Functionals/ana_hmixcoef.h
, /scratch/zhangxq/projects/txla_nesting6/Functionals/ana_nudgcoef.h, /scratch/zhangxq/projects/txla_nesting6/Functionals/ana_stflux.h" ;
:CPP_options = "TXLA, ADD_FSOBC, ADD_M2OBC, ANA_BSFLUX, ANA_BTFLUX, ASSUMED_SHAPE, BULK_FLUXES, CURVGRID, DIAGNOSTICS_UV, DIFF_GRID, DJ_GRADPS, D
OUBLE_PRECISION, EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3NUDGING, EAST_M3RADIATION, EAST_TNUDGING, EAST_TRADIATION, EMINUSP, LONGWAVE, M3CLIMATOLOGY, M3CLM_NUDGIN
G, MASKING, MIX_GEO_TS, MIX_S_UV, MPI, MY25_MIXING, NONLINEAR, NONLIN_EOS, NORTHERN_WALL, N2S2_HORAVG, POWER_LAW, PROFILE, QCORRECTION, K_GSCHEME, RAMP_TIDES, !R
ST_SINGLE, SALINITY, SOLAR_SOURCE, SOLVE3D, SOUTH_FSCHAPMAN, SOUTH_M2FLATHER, SOUTH_M3NUDGING, SOUTH_M3RADIATION, SOUTH_TNUDGING, SOUTH_TRADIATION, SPLINES, SSH_
TIDES, TCLIMATOLOGY, TCLM_NUDGING, THREE_GHOST, T_PASSIVE, TS_MPDATA, TS_DIF2, TS_PSOURCE, UV_ADV, UV_COR, UV_U3HADVECTION, UV_C4VADVECTION, UV_LOGDRAG, UV_PSOUR
CE, UV_TIDES, UV_VIS2, VAR_RHO_2D, VISC_GRID, WEST_FSCHAPMAN, WEST_M2FLATHER, WEST_M3NUDGING, WEST_M3RADIATION, WEST_TNUDGING, WEST_TRADIATION" ;
data:
...
-----
Density Calculation Program
---------------------------
The Python program that calculates the density fields and creates separate
NetCDF files in which to store them is:
-----
#!/usr/bin/python2.7
#
# This program creates a NetCDF file containing a 4-D density field
# from a NetCDF file containing temperature and salinity fields. It uses
# the Python package gsw available from:
#
# https://pypi.python.org/pypi/gsw/
#
# Usage: data2north.py
#
# The NetCDF files are stored in the directory 'd2northdir', and
# the resulting density files are stored in a subdirectory of
# that called 'density'.
#
# This will take many hours to process several dozen files.
import os
import numpy as np
import numpy.ma as ma
import netCDF4
import octant
from octant import csa
from netCDF4 import Dataset
import math, glob
import gsw
# Set the superdirectory containing the archive files.
# For the data2north files.
d2northdir = "/raid/zrong/data2North/"
# Set the file paths for the output NetCDF files.
# Path for storing the raw GRIB file GOM subset.
rhodir = "/raid/zrong/data2North/density/"
# Find all the subdirectories in the GRIB archive superdirectory.
# Move to appropriate directory.
os.chdir(d2northdir)
# Glob the files therein.
files = glob.glob("ocean*")
# Sort the files.
files.sort()
#files = ["ocean_his_0001.nc"]
# Loop over all of the ocean_his_*.nc files.
for filenm in files:
# Read input file.
inf = netCDF4.Dataset(filenm,'r')
# Extract temperature and salinity from input file.
temp = inf.variables['temp'][:]
salt = inf.variables['salt'][:]
tvar = inf.variables['temp']
fillval = tvar._FillValue
# Find dimensions of 4-D variable array.
dims = temp.shape
times = dims[0]
s_rho_dim = dims[1]
eta_rho_dim = dims[2]
xi_rho_dim = dims[3]
# Find name of and open output rho file.
splttr = filenm.split("_")
rhofn = "rho_" + splttr[2]
rhostr = rhodir + rhofn
outrho = netCDF4.Dataset(rhostr,'w',format='NETCDF3_CLASSIC')
print " Processing ",filenm," into ",rhofn
# Create dimensions for output rho file.
outrho.createDimension('ocean_time',None)
outrho.createDimension('s_rho',s_rho_dim)
outrho.createDimension('eta_rho',eta_rho_dim)
outrho.createDimension('xi_rho',xi_rho_dim)
# Create rho variable for output file.
out_rho = outrho.createVariable('rho','f4',('ocean_time','s_rho','eta_rho','xi_rho',),fill_value=fillval)
out_rho.long_name = "sigma-t"
out_rho.time = "ocean_time"
out_rho.units = "kilogram meter-3"
out_rho.standard_name = "sea_water_sigma_t"
out_rho.coordinates = "x_rho y_rho s_rho ocean_time"
out_rho.field = "density, scalar, series"
out_rho.note = "Density at zero pressure minus 1000 k/m3."
outrho.note1 = "Density computed with TEOS-10 Python package subroutine gsw.rho(S,T,P)."
outrho.software_url = "https://pypi.python.org/pypi/gsw/"
# Loop over all time steps in file.
for n in range(times):
# print " n = ",n," salt[n,10,10,10] = ",salt[n,10,10,10],"
# temp[n,10,10,10] = ",temp[n,10,10,10],
# for n in range(1,2):
out_rho[n,:] = gsw.rho(salt[n,:],temp[n,:],0.0) - 1000.
outrho.close()
inf.close()
-----
Density Files
-------------
The density files are created separately from the original files.
They can be easily combined with the original files using the NCO
command +ncrcat+, although that hasn't been done because we are
reticent about modifying the original files.
The density filenames are presently of the form +rho_*.nc+
where the asterisk is the four-digit number in
the original files. This filename can be changed via the
line:
-----
rhofn = "rho_" + splttr[2]
-----
in the program. Simply swap out whatever alternative name you
might desire for the +rho_+ part of that line.
NetCDF Header
~~~~~~~~~~~~~
A typical header for one of the density files created - i.e. +rho_0001.nc+ -
is:
-----
netcdf rho_0001 {
dimensions:
ocean_time = UNLIMITED ; // (101 currently)
s_rho = 30 ;
eta_rho = 191 ;
xi_rho = 671 ;
variables:
float rho(ocean_time, s_rho, eta_rho, xi_rho) ;
rho:_FillValue = 1.e+37f ;
rho:long_name = "sigma-t" ;
rho:time = "ocean_time" ;
rho:units = "kilogram meter-3" ;
rho:standard_name = "sea_water_sigma_t" ;
rho:coordinates = "x_rho y_rho s_rho ocean_time" ;
rho:field = "density, scalar, series" ;
rho:note = "Density at zero pressure minus 1000 k/m3." ;
// global attributes:
:note1 = "Density computed with TEOS-10 Python package subroutine gsw.rho(S,T,P)." ;
:software_url = "https://pypi.python.org/pypi/gsw/" ;
data:
...
-----