Re: NCL wrf_ll_to_ij / wrf_user_ll_to_ij error?

From: Jeff Steward <jeffsteward_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 03 2010 - 18:42:04 MST

Hi Dr. Correia,

Thanks! That was my problem. However when I switch the above lines
in my code to

jval = loc(0)
ival = loc(1)

I see that the distance is still off by 1.8 km. However, if I look at
(ival-1,jval-1) it seems correct.

Perhaps I need to subtract one from these indexes because of the
difference in Fortran (one-based) and NCL (zero-based) indexing?

On another note, I suggest improving the documentation found here:

http://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_ll_to_ij.shtml

It might be helpful to show an example on the above page where the i
and j values are used to retrieve, say, temperature.

Thanks again for your help!

Best wishes,

Jeff

On Wed, Mar 3, 2010 at 5:18 PM, Correia, James <james.correia@pnl.gov> wrote:
> Hi-
> I think you have your I's and j's mixed here:
> Yours:
> print("Requested: (" + pointLat + "," + pointLon + "), got (" +
> lat2d(ival,jval) + "," + lon2d(ival,jval) + ")")
>
> Mine:
> print("Requested: (" + pointLat + "," + pointLon + "), got (" +
>     lat2d(jval,ival)+","+lon2d(jval,ival)+")")
>
>
> The compare you are doing is slightly different because the 2 functions are slightly different.
> Jimmyc
>
> On 3/3/10 3:07 PM, "Jeff Steward" <jeffsteward@gmail.com> wrote:
>
> Hi,
>
> I have a 25km/5km/1km nested WRF model with a Lambert conformal
> mapping projection that I am working with.  I am trying to find the
> nearest grid point to a met tower that I have access to in order to
> validate the model.  I am using the NCL function wrf_user_ll_to_ij but
> I am getting a result that is significantly different than I expect.
> Am I doing something wrong or is there a bug?
>
> (Note that I have also tried this with the wrf_ll_to_ij function but
> get the same result).
>
> --------------------
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
>
> begin
>
> path_to_domain_3_output_file = ".........."
>
> a = addfile(path_to_domain_3_output_file,"r")
>
> lat2d = a->XLAT(0,:,:)
> lon2d = a->XLONG(0,:,:)
>
> opt = True
> opt@returnInt = True
>
> print(opt)
>
> pointLon = -87.9949
> pointLat =  41.7012
>
> loc = wrf_user_ll_to_ij (a, pointLon, pointLat, opt )
>
> ival = loc(0)
> jval = loc(1)
>
> print("i: " + ival + ", jval: " + jval)
>
> print("Requested: (" + pointLat + "," + pointLon + "), got (" +
> lat2d(ival,jval) + "," + lon2d(ival,jval) + ")")
>
> ival2 = ival-6
> jval2 = jval+4
>
> print("Compare:   (" + lat2d(ival2,jval2) + "," + lon2d(ival2,jval2) + ")")
>
> end
> --------------------
>
> The result I get is:
>
> --------------------
> (0)    i: 192, jval: 187
> (0)    Requested: (41.7012,-87.9949), got (41.76,-88.0333)
> (0)     Compare:    (41.7014,-87.9899)
> --------------------
>
> Note that the first distance between the point I requested and the
> point I received is is 7.2814 km while the distance between the
> requested and comparison points is only 0.4162 km according to the
> distance calculator found here:
>
> http://jan.ucc.nau.edu/~cvm/latlongdist.html
>
> I would expect to get the comparison values instead of the values I
> received.  Am I doing something wrong?
>
> Best wishes,
>
> Jeff
> _______________________________________________
> 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 Wed Mar 3 18:42:12 2010

This archive was generated by hypermail 2.1.8 : Thu Mar 04 2010 - 15:07:06 MST