Interpolation [message #90336] |
Sun, 22 February 2015 12:46  |
siumtesfai
Messages: 62 Registered: April 2013
|
Member |
|
|
Hi,
I have around 62 radiosonde station monthly data over North America region along with station latitude-longitude information.
I have monthly gridded data from ERA-Interim and CMIP5 climate models
at 2.5 X 2.5 degree spatial resolution from 1979 - 2012
I need to interpolate all monthly data to station latitude longitude.
Any help or suggestion will be appreciated.
Thanks
|
|
|
|
|
|
Re: Interpolation [message #90340 is a reply to message #90339] |
Sun, 22 February 2015 15:01   |
siumtesfai
Messages: 62 Registered: April 2013
|
Member |
|
|
On Sunday, February 22, 2015 at 5:00:57 PM UTC-5, David Fanning wrote:
> siumtesfai@gmail.com writes:
>
>> The location of my stations are random.
>
> Yes, these are the locations for which you are seeking fractional
> indices, right? Otherwise, your grid is regular in latitude and
> longitude.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
As you have suggested, I did the interpolation for station data
Do you think I have issue with Value_locate for latitude because my latitude ranges from -90 to 90 degree ?
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++
; Original model data at 192 X 96 degree spatial resolution
; Data = Array[lon,lat,pressure, time]
; data=Array[192, 96, 17, 1872]
; Extract one pressure level (e.g 850hPa) and interpolate to 2.5 X 2.5 degree spatial resolution
; Interpolated one pressure level data (WS)
WS=fltarr(144,73,n_elements(time))
; Now Interpolate again to a station data
slon = findgen(144)*2.5
slat = findgen(73)*2.5-90
; Station location example, at longitude 190 and latitude 37
; Find longitude fractional index.
slonval = 190
slonstep = slon[1] - slon[0]
closeIndex = Value_Locate(slon, slonval)
slonFracIndex = closeIndex + ((slonval - slon[closeIndex]) / slonstep)
; Find latitude fractional index.
slatval = 37
slatstep = slat[1] - slat[0]
closeIndex = Value_Locate(slat, slatval)
slatFracIndex = closeIndex + ((slatval - slat[closeIndex]) / slatstep)
interpValue=fltarr(ntime)+1E20
FOR i =0,n_elements(time)-1 do begin
griddedArray=reform(WS(*,*,i))
interpValue(i) = Interpolate(griddedArray, slonFracIndex, slatFracIndex)
ENDFOR
end
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++
|
|
|
Re: Interpolation [message #90341 is a reply to message #90340] |
Sun, 22 February 2015 15:18  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
siumtesfai@gmail.com writes:
> As you have suggested, I did the interpolation for station data
>
> Do you think I have issue with Value_locate for latitude because my latitude ranges from -90 to 90 degree ?
As with so many things dealing with map projections, it depends. :-)
I have on occasion duplicated the first column and added it as the last
column in my longitude and data arrays in situations like these. This
allows my longitude vector to go from 0 to 360, which matches my
latitude vector. That's probably what I would do in this case. That also
sometimes helps with a small gap in your plot when doing filled
contours, etc.
See the Array Concatenation Tutorial for how to add a column to an array
in the IDL Way:
http://www.idlcoyote.com/tips/array_concatenation.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|