Rather than continue this thread ... send the ftp the file. See below
---
[1] Your source data span
lon: 1.25 to 358.75
lon: -89 to 89
[2] Your destination grid
lon: 0.0 to 357.25
lat: -90 to 90
[3] As noted in the documentation:
"If the output coordinates (xo,yo) are outside those of the input
coordinates (xi,yi), then the fo values at those coordinates will be set
to missing (i.e. no extrapolation is performed)."
Hence, the pole latitudes will contain missing values since
the exceed the lat extremes of the input grid.
[4] Untested
filen=getenv("FILENAME")
a = addfile(filen,"r")
u1 = a->zg(:,3,:,:)
printVarSummary(u1)
;;;output
u1@_FillValue=1e+20
dimu1 = dimsizes(u1)
ntim = dimu1(0) ; number of time points
nlat = dimu1(1) ; number of latitudes
nlon = dimu1(2) ; number of lon
diro = "./" ; output directory
filo = "daily_model.dat" ; output file
ptho = diro+filo
system("/bin/rm -f "+ptho) ; rm any pre-exist file
;;interpolate to 2.5x2.5
mlon = 144
mlat = 73
klon = ispan(0,mlon-1,1)*2.5
;print(klon)
klat = ispan(0,mlat-1,1)*2.5
;print(klat)
model =linint2(u1&lon,u1&lat,u1,True,klon,klat,0) ;(ntim,mlat,mlon)
printVarSummary(model)
do nt=0,ntim-1 ; poles: average next to last latitude values
model(nt,mlat-1,:) = dim_avg(model(nt,mlat-2,:)) ; pole_nh
model(nt, 0 ,:) = dim_avg(model(nt, 1 ,:)) ; pole_sh
end do
;--- or
do nt=0,ntim-1 ; poles: use original pole values
model(nt,mlat-1,:) = dim_avg(u1(nt,nlat-1,:)) ; original values
model(nt, 0 ,:) = dim_avg(u1(nt, 0 ,:))
end do
;---
nmsg = num(ismissing(model))
print(nmsg)
fbinrecwrite (ptho, -1, model)
end
---
ftp ftp.cgd.ucar.edu
anonymous
<use your email address for the password>
cd incoming
put ...
quit
*After* successful transmiision of the file you must send us the
exact name of the file.
On 11/26/13 2:24 PM, Lorenzo de Cillia wrote:
> Thanks, I already changed it to true, but I still have the error....
>
> Lorenzo
>
>
> 2013/11/26 Adam Phillips <asphilli@ucar.edu>
>
>> Hi Lorenzo,
>> As you are now interpolating to a global grid, I think you want to set the
>> linint2 cyclic option to True..
>> Adam
>>
>>
>> On 11/26/2013 11:33 AM, Lorenzo de Cillia wrote:
>>
>> Hi Adam,
>>
>> Thank you for your help...
>> I changed the latitude to -90:90, but I still have the problem of missing
>> values in the interpolated data...
>> I added the input/output lon and lat down there, but I think they should
>> be fine?
>> Any idea what could cause my error?
>>
>> -------------------------------------------
>>
>> Variable: mlon
>> Type: double
>> Total Size: 1152 bytes
>> 144 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [lon | 144]
>> Coordinates:
>> Number Of Attributes: 5
>> axis : X
>> standard_name : longitude
>> bounds : lon_bnds
>> units : degrees_east
>> long_name : longitude
>> (0) 1.25
>> (1) 3.75
>> (2) 6.25
>> (3) 8.75
>> (4) 11.25
>> (5) 13.75
>> (6) 16.25
>> (7) 18.75
>> (8) 21.25
>> (9) 23.75
>> (10) 26.25
>> (11) 28.75
>> (12) 31.25
>> (13) 33.75
>> (14) 36.25
>> (15) 38.75
>> (16) 41.25
>> (17) 43.75
>> (18) 46.25
>> (19) 48.75
>> (20) 51.25
>> (21) 53.75
>> (22) 56.25
>> (23) 58.75
>> (24) 61.25000000000001
>> (25) 63.75000000000001
>> (26) 66.25
>> (27) 68.75
>> (28) 71.25
>> (29) 73.75
>> (30) 76.25
>> (31) 78.75
>> (32) 81.25
>> (33) 83.75
>> (34) 86.25
>> (35) 88.75
>> (36) 91.25
>> (37) 93.75
>> (38) 96.25
>> (39) 98.75
>> (40) 101.25
>> (41) 103.75
>> (42) 106.25
>> (43) 108.75
>> (44) 111.25
>> (45) 113.75
>> (46) 116.25
>> (47) 118.75
>> (48) 121.25
>> (49) 123.75
>> (50) 126.25
>> (51) 128.75
>> (52) 131.25
>> (53) 133.75
>> (54) 136.25
>> (55) 138.75
>> (56) 141.25
>> (57) 143.75
>> (58) 146.25
>> (59) 148.75
>> (60) 151.25
>> (61) 153.75
>> (62) 156.25
>> (63) 158.75
>> (64) 161.25
>> (65) 163.75
>> (66) 166.25
>> (67) 168.75
>> (68) 171.25
>> (69) 173.75
>> (70) 176.25
>> (71) 178.75
>> (72) 181.25
>> (73) 183.75
>> (74) 186.25
>> (75) 188.75
>> (76) 191.25
>> (77) 193.75
>> (78) 196.25
>> (79) 198.75
>> (80) 201.25
>> (81) 203.75
>> (82) 206.25
>> (83) 208.75
>> (84) 211.25
>> (85) 213.75
>> (86) 216.25
>> (87) 218.75
>> (88) 221.25
>> (89) 223.75
>> (90) 226.25
>> (91) 228.75
>> (92) 231.25
>> (93) 233.75
>> (94) 236.25
>> (95) 238.75
>> (96) 241.25
>> (97) 243.75
>> (98) 246.25
>> (99) 248.75
>> (100) 251.25
>> (101) 253.75
>> (102) 256.25
>> (103) 258.75
>> (104) 261.25
>> (105) 263.75
>> (106) 266.2500000000001
>> (107) 268.75
>> (108) 271.25
>> (109) 273.75
>> (110) 276.25
>> (111) 278.75
>> (112) 281.25
>> (113) 283.75
>> (114) 286.25
>> (115) 288.75
>> (116) 291.25
>> (117) 293.75
>> (118) 296.25
>> (119) 298.75
>> (120) 301.25
>> (121) 303.75
>> (122) 306.25
>> (123) 308.75
>> (124) 311.25
>> (125) 313.75
>> (126) 316.25
>> (127) 318.75
>> (128) 321.25
>> (129) 323.75
>> (130) 326.25
>> (131) 328.75
>> (132) 331.25
>> (133) 333.75
>> (134) 336.25
>> (135) 338.75
>> (136) 341.25
>> (137) 343.75
>> (138) 346.25
>> (139) 348.75
>> (140) 351.25
>> (141) 353.7500000000001
>> (142) 356.25
>> (143) 358.75
>>
>> Variable: mlat
>> Type: double
>> Total Size: 720 bytes
>> 90 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [lat | 90]
>> Coordinates:
>> Number Of Attributes: 5
>> axis : Y
>> standard_name : latitude
>> bounds : lat_bnds
>> units : degrees_north
>> long_name : latitude
>> (0) -89
>> (1) -87
>> (2) -85
>> (3) -83
>> (4) -81
>> (5) -79
>> (6) -77
>> (7) -75
>> (8) -73
>> (9) -71
>> (10) -69
>> (11) -67
>> (12) -65
>> (13) -63
>> (14) -61
>> (15) -59.00000000000001
>> (16) -57.00000000000001
>> (17) -55
>> (18) -53
>> (19) -51
>> (20) -49
>> (21) -47
>> (22) -45
>> (23) -43
>> (24) -41
>> (25) -39
>> (26) -37
>> (27) -35
>> (28) -33
>> (29) -31
>> (30) -29
>> (31) -27
>> (32) -25
>> (33) -23
>> (34) -21
>> (35) -19
>> (36) -17
>> (37) -15
>> (38) -13
>> (39) -11
>> (40) -9
>> (41) -7
>> (42) -5
>> (43) -3
>> (44) -1
>> (45) 1
>> (46) 3
>> (47) 5
>> (48) 7
>> (49) 9
>> (50) 11
>> (51) 13
>> (52) 15
>> (53) 17
>> (54) 19
>> (55) 21
>> (56) 23
>> (57) 25
>> (58) 27
>> (59) 29
>> (60) 31
>> (61) 33
>> (62) 35
>> (63) 37
>> (64) 39
>> (65) 41
>> (66) 43
>> (67) 45
>> (68) 47
>> (69) 49
>> (70) 51
>> (71) 53
>> (72) 55
>> (73) 57.00000000000001
>> (74) 59.00000000000001
>> (75) 61
>> (76) 63
>> (77) 65
>> (78) 67
>> (79) 69
>> (80) 71
>> (81) 73
>> (82) 75
>> (83) 77
>> (84) 79
>> (85) 81
>> (86) 83
>> (87) 85
>> (88) 87
>> (89) 89
>>
>> Variable: klon
>> Type: float
>> Total Size: 576 bytes
>> 144 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [144]
>> Coordinates:
>> (0) 0
>> (1) 2.5
>> (2) 5
>> (3) 7.5
>> (4) 10
>> (5) 12.5
>> (6) 15
>> (7) 17.5
>> (8) 20
>> (9) 22.5
>> (10) 25
>> (11) 27.5
>> (12) 30
>> (13) 32.5
>> (14) 35
>> (15) 37.5
>> (16) 40
>> (17) 42.5
>> (18) 45
>> (19) 47.5
>> (20) 50
>> (21) 52.5
>> (22) 55
>> (23) 57.5
>> (24) 60
>> (25) 62.5
>> (26) 65
>> (27) 67.5
>> (28) 70
>> (29) 72.5
>> (30) 75
>> (31) 77.5
>> (32) 80
>> (33) 82.5
>> (34) 85
>> (35) 87.5
>> (36) 90
>> (37) 92.5
>> (38) 95
>> (39) 97.5
>> (40) 100
>> (41) 102.5
>> (42) 105
>> (43) 107.5
>> (44) 110
>> (45) 112.5
>> (46) 115
>> (47) 117.5
>> (48) 120
>> (49) 122.5
>> (50) 125
>> (51) 127.5
>> (52) 130
>> (53) 132.5
>> (54) 135
>> (55) 137.5
>> (56) 140
>> (57) 142.5
>> (58) 145
>> (59) 147.5
>> (60) 150
>> (61) 152.5
>> (62) 155
>> (63) 157.5
>> (64) 160
>> (65) 162.5
>> (66) 165
>> (67) 167.5
>> (68) 170
>> (69) 172.5
>> (70) 175
>> (71) 177.5
>> (72) 180
>> (73) 182.5
>> (74) 185
>> (75) 187.5
>> (76) 190
>> (77) 192.5
>> (78) 195
>> (79) 197.5
>> (80) 200
>> (81) 202.5
>> (82) 205
>> (83) 207.5
>> (84) 210
>> (85) 212.5
>> (86) 215
>> (87) 217.5
>> (88) 220
>> (89) 222.5
>> (90) 225
>> (91) 227.5
>> (92) 230
>> (93) 232.5
>> (94) 235
>> (95) 237.5
>> (96) 240
>> (97) 242.5
>> (98) 245
>> (99) 247.5
>> (100) 250
>> (101) 252.5
>> (102) 255
>> (103) 257.5
>> (104) 260
>> (105) 262.5
>> (106) 265
>> (107) 267.5
>> (108) 270
>> (109) 272.5
>> (110) 275
>> (111) 277.5
>> (112) 280
>> (113) 282.5
>> (114) 285
>> (115) 287.5
>> (116) 290
>> (117) 292.5
>> (118) 295
>> (119) 297.5
>> (120) 300
>> (121) 302.5
>> (122) 305
>> (123) 307.5
>> (124) 310
>> (125) 312.5
>> (126) 315
>> (127) 317.5
>> (128) 320
>> (129) 322.5
>> (130) 325
>> (131) 327.5
>> (132) 330
>> (133) 332.5
>> (134) 335
>> (135) 337.5
>> (136) 340
>> (137) 342.5
>> (138) 345
>> (139) 347.5
>> (140) 350
>> (141) 352.5
>> (142) 355
>> (143) 357.5
>>
>>
>> Variable: klat
>> Type: float
>> Total Size: 292 bytes
>> 73 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [73]
>> Coordinates:
>> (0) -90
>> (1) -87.5
>> (2) -85
>> (3) -82.5
>> (4) -80
>> (5) -77.5
>> (6) -75
>> (7) -72.5
>> (8) -70
>> (9) -67.5
>> (10) -65
>> (11) -62.5
>> (12) -60
>> (13) -57.5
>> (14) -55
>> (15) -52.5
>> (16) -50
>> (17) -47.5
>> (18) -45
>> (19) -42.5
>> (20) -40
>> (21) -37.5
>> (22) -35
>> (23) -32.5
>> (24) -30
>> (25) -27.5
>> (26) -25
>> (27) -22.5
>> (28) -20
>> (29) -17.5
>> (30) -15
>> (31) -12.5
>> (32) -10
>> (33) -7.5
>> (34) -5
>> (35) -2.5
>> (36) 0
>> (37) 2.5
>> (38) 5
>> (39) 7.5
>> (40) 10
>> (41) 12.5
>> (42) 15
>> (43) 17.5
>> (44) 20
>> (45) 22.5
>> (46) 25
>> (47) 27.5
>> (48) 30
>> (49) 32.5
>> (50) 35
>> (51) 37.5
>> (52) 40
>> (53) 42.5
>> (54) 45
>> (55) 47.5
>> (56) 50
>> (57) 52.5
>> (58) 55
>> (59) 57.5
>> (60) 60
>> (61) 62.5
>> (62) 65
>> (63) 67.5
>> (64) 70
>> (65) 72.5
>> (66) 75
>> (67) 77.5
>> (68) 80
>> (69) 82.5
>> (70) 85
>> (71) 87.5
>> (72) 90
>>
>>
>>
>>
>>
>>
>>
>> 2013/11/26 Adam Phillips <asphilli@ucar.edu>
>>
>>> Hi Lorenzo,
>>> Whenever linint2/linint2_Wrap are used one has to check to make sure that
>>> the input and output grids are overlapping and are oriented the same
>>> direction. So if you are having trouble with those functions I would take a
>>> close look at your input/output latitudes/longitudes. I cannot see what
>>> your input latitudes and longitudes are, but they should match your output
>>> latitudes/longitudes which run from south->north (lat) and from 0->357.5E.
>>>
>>> However, I see that you are setting you output latitudes like this:
>>> klat = ispan(0,72,1)*2.5
>>> That results in a latitude array from 0->180, which is outside the range
>>> of -90:90. So I am guessing that that line is causing your problem.
>>>
>>> If you have any further questions please respond to ncl-talk..
>>> Adam
>>>
>>> On 11/26/2013 10:36 AM, Lorenzo de Cillia wrote:
>>>
>>> Hello!
>>>
>>> I have a problem with the following NCL script....
>>> I'm reading out geopotential height data from a .nc file and try to
>>> interpolate it to a 2.5x2.5 grid with the function linint2...
>>>
>>> The problem is that I got a lot of missing values (so 1e+20) in the
>>> results and I don't know why... Can please somebody tell me if there's an
>>> error in the script or in the usage of the linint2 function?
>>>
>>> Thank you for your help,
>>>
>>> Lorenzo
>>>
>>> ------------------------------
>>> -------------
>>>
>>> begin
>>> filen=getenv("FILENAME")
>>>
>>> ;; print (filen)
>>> a = addfile(filen,"r")
>>>
>>> u1 = a->zg(:,3,:,:)
>>>
>>> ;;;output
>>> u1@_FillValue=1e+20
>>> npts = dimsizes(u1(:,0,0)) ; number of time points
>>> nlat = dimsizes(u1(0,:,0)) ; number of latitudes
>>> nlon = dimsizes(u1(0,0,:)) ; number of lon
>>>
>>> um=new ( (/nlat,nlon /), float)
>>> filo = "daily_model.dat" ; output file
>>>
>>> ;;interpolate to 2.5x2.5
>>>
>>> mlon = u1&lon
>>> mlat = u1&lat
>>> print(mlat)
>>>
>>> klon = ispan(0,143,1)*2.5
>>> print(klon)
>>> klat = ispan(0,72,1)*2.5
>>> print(klat)
>>>
>>> ;print(u1)
>>> model =linint2(mlon,mlat,u1,False,klon,klat,0)
>>> printVarSummary(model)
>>> print(model)
>>> fbinrecwrite (filo, -1, model)
>>> end
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>> --
>>> ______________________________________________________________
>>> Adam Phillips asphilli@ucar.edu
>>> NCAR/Climate and Global Dynamics Division (303) 497-1726
>>> P.O. Box 3000
>>> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> --
>> ______________________________________________________________
>> Adam Phillips asphilli@ucar.edu
>> NCAR/Climate and Global Dynamics Division (303) 497-1726
>> P.O. Box 3000
>> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
>>
>>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 26 15:02:03 2013
This archive was generated by hypermail 2.1.8 : Wed Dec 04 2013 - 20:42:38 MST