comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Interpolation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Interpolation [message #90336] Sun, 22 February 2015 12:46 Go to next message
siumtesfai is currently offline  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 #90337 is a reply to message #90336] Sun, 22 February 2015 13:09 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
siumtesfai@gmail.com writes:

> 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.

http://www.idlcoyote.com/math_tips/interpgrid.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.")
Re: Interpolation [message #90338 is a reply to message #90337] Sun, 22 February 2015 13:44 Go to previous messageGo to next message
siumtesfai is currently offline  siumtesfai
Messages: 62
Registered: April 2013
Member
On Sunday, February 22, 2015 at 4:10:00 PM UTC-5, David Fanning wrote:
> siumtesfai@gmail.com writes:
>
>> 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.
>
> http://www.idlcoyote.com/math_tips/interpgrid.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.")

Hi

The location of my stations are random.

do you think it is best to use closest.pro to extract the closest nearby grid boxs from the models
Re: Interpolation [message #90339 is a reply to message #90338] Sun, 22 February 2015 14:00 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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.")
Re: Interpolation [message #90340 is a reply to message #90339] Sun, 22 February 2015 15:01 Go to previous messageGo to next message
siumtesfai is currently offline  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 Go to previous message
David Fanning is currently offline  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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: [start:final:step] bug
Next Topic: Direction of Wind Vectors: A bug?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:34:04 PDT 2025

Total time taken to generate the page: 0.00461 seconds