Re: Regriding Problem

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sun Oct 27 2013 - 08:14:49 MDT

linint2, linint2_points and the associated _Wrap functions
require that the 'xi' (lon), 'xo' (LON), 'yi' (lat) and 'yo' (LAT)
be a "a 1D monotonically increasing array". You have the 1D but your
'yi' and 'yo' coordinates are monotonically decreasing.

Also, when reading an entire variable, it is more efficient to not
use the : syntax. If you want to note it is 4D, add that as
a comment.

untested

air2 = short2flt(f->air) ; lat: N->S (:,:,:,:)
printVarSummary(air2)

air2 = air2(:,:,::-1,:) ; reverse latitudes

printVarSummary(air2) ; lat: S->N
print("air2: min="+min(air2)+" max="+max(air2))

;create lat & lon arrays
LAT=fspan(-40.00,-37.00,3) ; S->N
LON=fspan(6.00,53.00,47)
LAT@units = "degrees_south"
LON@units = "degrees_east"

print(LAT)
print(LON)

;interpolate to new lat & lon arrays
regrid = linint2_Wrap(air2&lon,air2&lat,air2,True,LON,LAT,0)

printVarSummary(regrid)
print("regrid: min="+min(regrid)+" max="+max(regrid))

; if desired ... reverse the order

regrid = regrid(:,:,::-1,:)
printVarSummary(regrid)
~

On 10/26/13 1:10 AM, Ditiro Moalafhi wrote:
> Dear NCl-talk
>
> I am trying to interpolate temperature from an NCEP1 file into new lat and lon but the interpolated temperature shows different min and max with same value of 9.96921e+36. Could someone advise.
> The part of the script and output are shown below
>
> SCRIPT
> ;load variables
> air2 = short2flt(f->air(:,:,:,:))
> printVarSummary(air2)
> air2@_FillValue = 32766
> air2@missing_value = air2@_FillValue
> print("air2: min="+min(air2)+" max="+max(air2))
>
> ;create lat & lon arrays
> LAT=fspan(-37.00,-40.00,3)
> LON=fspan(6.00,53.00,47)
> LAT@units = "degrees_south"
> LON@units = "degrees_east"
>
> ;interpolate to new lat & lon arrays
> regrid=linint2_Wrap(air2&lon,air2&lat,air2,True,LON,LAT,0)
> print("regrid: min="+min(regrid)+" max="+max(regrid))
> printVarSummary(regrid)
>
> OUTPUT
> Variable: air2
> Type: float
> Total Size: 1043631360 bytes
> 260907840 values
> Number of Dimensions: 4
> Dimensions and sizes: [time | 1460] x [level | 17] x [lat | 73] x [lon | 144]
> Coordinates:
> time: [1779456..1788210]
> level: [1000..10]
> lat: [90..-90]
> lon: [ 0..357.5]
> Number Of Attributes: 19
> long_name : 6-hourly Air Temperature on Pressure Levels
> unpacked_valid_range : ( 137.5, 362.5 )
> actual_range : ( 179.3, 326.2 )
> units : degK
> missing_value_original : 32766
> _FillValue_original : -32767
> _FillValue : -32767
> precision : 2
> least_significant_digit : 1
> GRIB_id : 11
> GRIB_name : TMP
> var_desc : Air temperature
> dataset : NCEP/DOE AMIP-II Reanalysis (Reanalysis-2)
> level_desc : Pressure Levels
> statistic : Individual Obs
> parent_stat : Other
> standard_name : air_temperature
> valid_range : ( 137.5, 362.55 )
> missing_value : -32767
> (0) air2: min=179.3 max=326.2
> (0) regrid: min=9.96921e+36 max=9.96921e+36
>
> Variable: regrid
> Type: float
> Total Size: 13998480 bytes
> 3499620 values
> Number of Dimensions: 4
> Dimensions and sizes: [time | 1460] x [level | 17] x [LAT | 3] x [LON | 47]
> Coordinates:
> time: [1779456..1788210]
> level: [1000..10]
> LAT: [-37..-40]
> LON: [ 6..53]
> Number Of Attributes: 19
> long_name : 6-hourly Air Temperature on Pressure Levels
> unpacked_valid_range : ( 137.5, 362.5 )
> actual_range : ( 179.3, 326.2 )
> units : degK
> missing_value_original : 32766
> _FillValue_original : -32767
> _FillValue : 32766
> precision : 2
> least_significant_digit : 1
> GRIB_id : 11
> GRIB_name : TMP
> var_desc : Air temperature
> dataset : NCEP/DOE AMIP-II Reanalysis (Reanalysis-2)
> level_desc : Pressure Levels
> statistic : Individual Obs
> parent_stat : Other
> standard_name : air_temperature
> valid_range : ( 137.5, 362.55 )
> missing_value : 32766
> warning:int2p_n: 205860 input array(s) contained all missing data. No interpolation performed on these arrays
>
> Thanks
> Ditiro
>
>
>
>
> _______________________________________________
> 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 Sun Oct 27 08:14:52 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 01 2013 - 08:58:14 MDT