1
// Bilinear interpolation
3
// Online: http://nco.sourceforge.net/nco.html#Regrid-MODIS-Data
5
defdim("latn",192); // Define new dimension: latitude
6
defdim("lonn",288); // Define new dimension: longitude
7
latn[$latn] = {90,89.0576 ,88.1152 ,87.1728 ,86.2304 ,85.288 ,\
8
84.3456 ,83.4031 ,82.4607 ,81.5183 ,80.5759 ,79.6335 ,78.6911 ,\
9
77.7487 ,76.8063 ,75.8639 ,74.9215 ,73.9791 ,73.0367 ,72.0942 ,\
10
71.1518 ,70.2094 ,69.267 ,68.3246 ,67.3822 ,66.4398 ,65.4974 ,\
11
64.555 ,63.6126 ,62.6702 ,61.7277 ,60.7853 ,59.8429 ,58.9005 ,\
12
57.9581 ,57.0157 ,56.0733 ,55.1309 ,54.1885 ,53.2461 ,52.3037 ,\
13
51.3613 ,50.4188 ,49.4764 ,48.534 ,47.5916 ,46.6492 ,45.7068 ,\
14
44.7644 ,43.822 ,42.8796 ,41.9372 ,40.9948 ,40.0524 ,39.11 ,\
15
38.1675 ,37.2251 ,36.2827 ,35.3403 ,34.3979 ,33.4555 ,32.5131 ,\
16
31.5707 ,30.6283 ,29.6859 ,28.7435 ,27.8011 ,26.8586 ,25.9162 ,\
17
24.9738 ,24.0314 ,23.089 ,22.1466 ,21.2042 ,20.2618 ,19.3194 ,\
18
18.377 ,17.4346 ,16.4921 ,15.5497 ,14.6073 ,13.6649 ,12.7225 ,\
19
11.7801 ,10.8377 ,9.89529 ,8.95288 ,8.01047 ,7.06806 ,6.12565 ,\
20
5.18325 ,4.24084 ,3.29843 ,2.35602 ,1.41361 ,0.471204,-0.471204,\
21
-1.41361,-2.35602,-3.29843,-4.24084,-5.18325,-6.12565,-7.06806,\
22
-8.01047,-8.95288,-9.89529,-10.8377,-11.7801,-12.7225,-13.6649,\
23
-14.6073,-15.5497,-16.4921,-17.4346,-18.377 ,-19.3194,-20.2618,\
24
-21.2042,-22.1466,-23.089 ,-24.0314,-24.9738,-25.9162,-26.8586,\
25
-27.8011,-28.7435,-29.6859,-30.6283,-31.5707,-32.5131,-33.4555,\
26
-34.3979,-35.3403,-36.2827,-37.2251,-38.1675,-39.11 ,-40.0524,\
27
-40.9948,-41.9372,-42.8796,-43.822 ,-44.7644,-45.7068,-46.6492,\
28
-47.5916,-48.534 ,-49.4764,-50.4188,-51.3613,-52.3037,-53.2461,\
29
-54.1885,-55.1309,-56.0733,-57.0157,-57.9581,-58.9005,-59.8429,\
30
-60.7853,-61.7277,-62.6702,-63.6126,-64.555 ,-65.4974,-66.4398,\
31
-67.3822,-68.3246,-69.267 ,-70.2094,-71.1518,-72.0942,-73.0367,\
32
-73.9791,-74.9215,-75.8639,-76.8063,-77.7487,-78.6911,-79.6335,\
33
-80.5759,-81.5183,-82.4607,-83.4031,-84.3456,-85.288,-86.2304,\
34
-87.1728,-88.1152,-89.0576,-90}; // Copy of CCSM4 latitude
35
lonn[$lonn] = {-178.75,-177.5,-176.25,-175,-173.75,-172.5,-171.25,\
36
-170,-168.75,-167.5,-166.25,-165,-163.75,-162.5,-161.25,-160,\
37
-158.75,-157.5,-156.25,-155,-153.75,-152.5,-151.25,-150,-148.75,\
38
-147.5,-146.25,-145,-143.75,-142.5,-141.25,-140,-138.75,-137.5,\
39
-136.25,-135,-133.75,-132.5,-131.25,-130,-128.75,-127.5,-126.25,\
40
-125,-123.75,-122.5,-121.25,-120,-118.75,-117.5,-116.25,-115,\
41
-113.75,-112.5,-111.25,-110,-108.75,-107.5,-106.25,-105,-103.75,\
42
-102.5,-101.25,-100,-98.75,-97.5,-96.25,-95,-93.75,-92.5,-91.25,\
43
-90,-88.75,-87.5,-86.25,-85,-83.75,-82.5,-81.25,-80,-78.75,-77.5,\
44
-76.25,-75,-73.75,-72.5,-71.25,-70,-68.75,-67.5,-66.25,-65,-63.75,\
45
-62.5,-61.25,-60,-58.75,-57.5,-56.25,-55,-53.75,-52.5,-51.25,-50,\
46
-48.75,-47.5,-46.25,-45,-43.75,-42.5,-41.25,-40,-38.75,-37.5,\
47
-36.25,-35,-33.75,-32.5,-31.25,-30,-28.75,-27.5,-26.25,-25,-23.75,\
48
-22.5,-21.25,-20,-18.75,-17.5,-16.25,-15,-13.75,-12.5,-11.25,-10,\
49
-8.75,-7.5,-6.25,-5,-3.75,-2.5,-1.25,0,1.25,2.5,3.75,5,6.25,7.5,\
50
8.75,10,11.25,12.5,13.75,15,16.25,17.5,18.75,20,21.25,22.5,23.75,\
51
25,26.25,27.5,28.75,30,31.25,32.5,33.75,35,36.25,37.5,38.75,40,\
52
41.25,42.5,43.75,45,46.25,47.5,48.75,50,51.25,52.5,53.75,55,56.25,\
53
57.5,58.75,60,61.25,62.5,63.75,65,66.25,67.5,68.75,70,71.25,72.5,\
54
73.75,75,76.25,77.5,78.75,80,81.25,82.5,83.75,85,86.25,87.5,88.75,\
55
90,91.25,92.5,93.75,95,96.25,97.5,98.75,100,101.25,102.5,103.75,\
56
105,106.25,107.5,108.75,110,111.25,112.5,113.75,115,116.25,117.5,\
57
118.75,120,121.25,122.5,123.75,125,126.25,127.5,128.75,130,131.25,\
58
132.5,133.75,135,136.25,137.5,138.75,140,141.25,142.5,143.75,145,\
59
146.25,147.5,148.75,150,151.25,152.5,153.75,155,156.25,157.5,\
60
158.75,160,161.25,162.5,163.75,165,166.25,167.5,168.75,170,171.25,\
61
172.5,173.75,175,176.25,177.5,178.75,180}; // Copy of CCSM4 longitude
63
*out[$time,$latn,$lonn]=0.0; // Output structure
65
// Bi-linear interpolation
66
bsa_sw_less=bilinear_interp_wrap(bsa_sw,out,latn,lonn,lat,lon);
67
wsa_sw_less=bilinear_interp_wrap(wsa_sw,out,latn,lonn,lat,lon);
70
latn@units = "degree_north";
71
lonn@units = "degree_east";
72
latn@long_name = "latitude";
73
lonn@long_name = "longitude";
74
bsa_sw_less@hdf_name = "Albedo_BSA_shortwave";
75
bsa_sw_less@calibrated_nt = 5;
76
bsa_sw_less@missing_value = 32767.0;
77
bsa_sw_less@units = "albedo, no units";
78
bsa_sw_less@long_name = "Global_Albedo_BSA_shortwave";
79
wsa_sw_less@hdf_name = "Albedo_WSA_shortwave";
80
wsa_sw_less@calibrated_nt = 5;
81
wsa_sw_less@missing_value = 32767.0;
82
wsa_sw_less@units = "albedo, no units";
83
wsa_sw_less@long_name = "Global_Albedo_WSA_shortwave";