[Thread Prev][Thread Next][Index]

[ferret_users] interpolating lon,lat coordinates to i,j indices



Dear Ferret users,

I regularly plot WRF data on a curved grid where lon,lat fields (2d)
are available.  This works fine with the 3 argument versions of shade
and fill  (shade variable,lonfield,latfield).  I plot coastlines from
a netcdf database which contains high resolution coastlines as an
i-series (longitude and latitude variables) with

plot /vs /overlay coast_lon, coast_lat

that also works fine.

Now, for larger grids where the lambert projection starts to seriously
deform when shown in regular lon,lat projection, I'd like to reverse
the approach: I'd like to plot the model grid as rectangular (which it
is, roughly, in kilometers) and THEN overlay the coastlines.

As this robs Ferret of any notion of a coordinate system, things
become more tricky.  I'd need to know the matching i,j values for each
lon,lat point of the coastline, before I can overlay the coastlines on
top of the shaded field.  So, what I would like is this:

shade model_field      (simple i,j 2D chart with no abstract i,j axes)
plot /vs /overlay  coast_i, coast_j

Can anyone come up with a way to compute coast_i and coast_j, given
that I have

coast_lon[i=1:N]
coast_lat[i=1:N]

wrf_lon[i=1:P, j=1:Q]
wrf_lat[i=1:P, j=1:Q]
wrf_data[i=1:P, j=1:Q]

?  I'm looking at sample_xy but I don't think those will work, as I
would need "I" and "J" fields defined on a regular lon/lat grid.
Scat2gridgauss_xy would work in theory, but it demands that the target
grid is regular.  My target grid would consist of the lat and lon
values along the coastline: I want something like this (which won't work, I think):

coast_i = scat2gridgauss_xy(wrf_lon,wrf_lat,wrf_i, coast_lon, coast_lat, ...)

Can anyone come up with a solution to let ferret compute these i,j
coordinates for the coastlines?  If I can't figure it out I'll write a
MATLAB or C program which computes them once for my WRF domain.  A
dynamic solution in Ferret would be preferable, so things keep working
when the domain changes.


Thanks for your input!

Kind regards,

     Hein Zelle


-- 

 Unix is user friendly. It's just very particular about who 
 it's friends are.

 Hein Zelle                     hein@xxxxxxxxxxx
	                        http://www.icce.rug.nl/~hein



[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement