Re: Interpolate WRF data on Mercator projection to Cartesian grid

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 30 Jan 2006 21:50:21 -0700 (MST)

> I need to interpolate WRF data on native Mercator projection to the x,
> y, z Cartesian coordinates. Please let me know whether or not NCL can do this
> and how. Thank you.

The question is a bit open-ended.

(1) If you want "cartesian" relative to the plot frame, you
     could use the function "datatondc"

     However, I do not think this is what you want.

(2) I think the "gc_latlon" function could be used

     The following uses the equator as the "origin"

     You could then write the x and y coordinates to a file.

     I will request that the gc_latlon function be
     made to operate on arrays. That will speed things up.

   f = addfile("", "r")

   lat1d = ndtooned( f->XLAT(0,:,:) )
   lon1d = ndtooned( f->XLONG(0,:,:))
   npts = dimsizes( lat1d )

   lato = 0.0 ; origin
   lono = 0.0

   x = new ( npts, "float")
   y = new ( npts, "float")

   do n=0,npts-1
      x(n) = gc_latlon(lato,lono, lato ,lon1d(n), 2,3) ; x-axis
      y(n) = gc_latlon(lato,lono, lat1d(n),lono , 2,3) ; y-axis
      if (lon1d(n).lt.0) then
          x(n) = -1*x(n)
      end if
      if (lat1d(n).lt.0) then
          y(n) = -1*y(n)
      end if
      print(lat1d(n)+" "+lon1d(n)+" "+x(n)+" "+y(n))
   end do

ncl-talk mailing list
Received on Mon Jan 30 2006 - 21:50:21 MST

This archive was generated by hypermail 2.2.0 : Tue Jan 31 2006 - 14:26:26 MST