File: tst.nco

package info (click to toggle)
nco 2.9.9-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,040 kB
  • ctags: 2,224
  • sloc: ansic: 17,950; sh: 11,178; cpp: 2,252; makefile: 1,277; lex: 1,041; perl: 586; yacc: 543
file content (78 lines) | stat: -rw-r--r-- 3,053 bytes parent folder | download | duplicates (2)
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
// $Header: /cvsroot/nco/nco/data/tst.nco,v 1.6 2002/08/13 06:35:13 zender Exp $ -*-C-*-

// Purpose: ncap script for geophysical computations

/* Usage:
   ncap -v -O -D 1 -S ${HOME}/nco/data/tst.nco ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc
   ncks -C -H -u -v mxdgr_lcl ${HOME}/nco/data/foo.nc */

rds_earth=6.370e+06; // (6.370e+06) [m] Radius of sphere of same volume as Earth
rds_earth@long_name="Radius of sphere of same volume as Earth";
rds_earth@units="meter";

pi=3.1415926535897932384626433832795029L; // (3.1415926535897932384626433832795029L) [frc] 3
pi@long_name="Pi";
pi@units="fraction";

lat_lcl_dgr=16.75; // [dgr] Local latitude
lat_lcl_dgr@long_name="Local latitude";
lat_lcl_dgr@units="degree";

lat_lcl=lat_lcl_dgr*(pi/180.0); // [rdn] Local latitude
lat_lcl@long_name="Local latitude";
lat_lcl@units="radian";

rds_lcl=rds_earth*cos(lat_lcl); // [m] Distance from axis of rotation at local latitude
rds_lcl@long_name="Distance from axis of rotation at local latitude";
rds_lcl@units="meter";

crc_lcl=2.0*pi*rds_lcl; // [m] Circumference of earth along local latitude
crc_lcl@long_name="Circumference of earth along local latitude";
crc_lcl@units="meter";

mxdgr_lcl=crc_lcl/360.0; // [m dgr-1] Meters per degree at local latitude
mxdgr_lcl@long_name="Meters per degree at local latitude";
mxdgr_lcl@units="meter degree-1";

// Compute fraction of lognormal distribution that lies between two endpoints
gsd=2.0; // [frc] Geometric standard deviation
gsd@long_name="Geometric standard deviation";
gsd@units="fraction";

dmt_vma=2.5; // [m] Volume median diameter analytic
dmt_vma@long_name="Volume median diameter analytic";
dmt_vma@units="meter";

dmt_min=5.0; // [m] Minimum diameter
dmt_min@long_name="Minimum diameter";
dmt_min@units="meter";

dmt_max=10.0; // [m] Maximum diameter
dmt_max@long_name="Maximum diameter";
dmt_max@units="meter";

// ncap -v -O -s "gsd=2.0;dmt_vma=2.5;dmt_min=5.0;dmt_max=10.0;ovr_frc=0.5*(erf(log(dmt_max/dmt_vma)/(sqrt(2.0)*log(gsd)))-erf(log(dmt_min/dmt_vma)/(sqrt(2.0)*log(gsd))))));" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc;ncks -H -C -u ${HOME}/nco/data/foo.nc
ovr_frc=0.5*(erf(log(dmt_max/dmt_vma)/(sqrt(2.0)*log(gsd)))-erf(log(dmt_min/dmt_vma)/(sqrt(2.0)*log(gsd)))))); // [frc] Fraction of lognormal distribution between endpoints
ovr_frc@long_name="Fraction of lognormal distribution between endpoints";
ovr_frc@units="fraction";

// Compute specific extinction coefficient of dust from bin-resolved mixing ratios
mss_frc_ttl=2.09e-09+9.13e-09+8.18e-09+1.58e-09; // [kg kg-1] Total dust mixing ratio
mss_frc1=2.09e-09/mss_frc_ttl;
mss_frc2=9.13e-09/mss_frc_ttl;
mss_frc3=8.18e-09/mss_frc_ttl;
mss_frc4=1.58e-09/mss_frc_ttl;
ext_cff_mss1=2.893e3*mss_frc1;
ext_cff_mss2=8.350e2*mss_frc2;
ext_cff_mss3=3.825e2*mss_frc3;
ext_cff_mss4=1.961e2*mss_frc4;
ext_cff_mss_ttl=ext_cff_mss1+ext_cff_mss2+ext_cff_mss3+ext_cff_mss4;

// This command is placed here for consistancy with NCO User's Guide ncap example
a=3;b=4;c=sqrt(a^2+b^2);

/*
foo=; // 
foo@long_name="";
foo@units="";
*/