[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Re: 20040322: Any idea why gribtocdl does a "floating exception" on this file?



On Tue, 30 Mar 2004, Richard Signell wrote:

> Robb Kambic wrote:
> >
> > Rich,
> >
> > I have the formulas needed but the results don't seem correct to me. The
> > pole is lat/lon  (-32.5, 10).  So ( -24, -5 ) -> ( -32.5, 10 ) and
> > (-7,063, 9.563 ) -> ( -15.563, 24.563 ) Since the rotation angle is 0,
> > there is no rotation.    The lat/lon increment is .065535004
> >
> > The problem is the calculated corner from the starting point of
> > ( -32.5, 10 ) ends up at ( -17.23, 27.76 ) instead of the given one
> > ( -15.563, 24.563 ).  It's a couple of degrees off.  I don't think it's a
> > rounding err, so I must be missing something.
> >
>
>
> I think I see your problem.   In the rotated pole coordinate, the grid
> is uniformly spaced in lat/lon, but in the rotated pole coordinate,
> it *is not*.   You therefore need 2D arrays to hold the true lon/lat
> values, and you need to compute each of these values using the formula.

Rich,

OK, I duplicated the code and the results still are not correct. ie

should be lon= 24.563 and lat =  -15.563

straight increment, had error in first calculation
lon[ 234 ] = 25.269655932, lat[ 272 ] = -14.7400139159998

results from duplicated rtll
almd=44.4907691654722, aphd=-43.1948333734209

How about you send the lat lon values thru MatLab and see what values you
get for the ending coordinates.

Robb..


>
> In other words, you need to loop thru each grid point(e.g.):
>
> for j=1:272
>   lat=lat(j);
>   for i=1:234
>     lon=lon(i)
>     [lon_true(i,j),lat_true(i,j)]=rtll(pole_lon,pole_lat,lon(i),lat(i));
>   end
> end
>
> and lon_true, lat_true will be 2D arrays:
>
> lon_true(lat,lon)
> lat_true(lat,lon)
>
>
> > On Mon, 29 Mar 2004, Richard Signell wrote:
> >
> > > Robb,
> > >
> > > If it's helpful, here is my MATLAB function for deriving true lon,lat
> > > from the rotated pole lon,lat.
> > >
> > > function [almd,aphd]=rtll(tlm0d,tph0d,tlmd,tphd);
> > > %-------------------------------------------------------------------------
> > > % RTLL transforms rotated coordinates (tlmd,tphd) into
> > > % ordinary geographic coordinates (almd,aphd). i/o decimal degrees (DD)
> > > % tlm0d, tph0d: lon e lat of the center of rotation ("North Pole") in
> > > DD.
> > > %
> > > dtr=pi/180.;
> > >
> > > ctph0=cos(tph0d*dtr);
> > > stph0=sin(tph0d*dtr);
> > >
> > > stph=sin(tphd*dtr);
> > > ctph=cos(tphd*dtr);
> > > ctlm=cos(tlmd*dtr);
> > > stlm=sin(tlmd*dtr);
> > >
> > > aph=asin(stph0.*ctph.*ctlm+ctph0.*stph);
> > > cph=cos(aph);
> > >
> > > almd=tlm0d+asin(stlm.*ctph./cph)/dtr;
> > > aphd=aph/dtr;
> > > % end
> > >
> > >
> > > -Rich
> > >
> > >
>
> --
> Dr. Richard P. Signell                 |  address@hidden
> NATO/SACLANT Undersea Research Centre  |    Tel: (+39) 0187 527 381
> Viale San Bartolomeo 400               |    Fax: (+39) 0187 527 331
> 19138 La Spezia, ITALY  --> From USA/CANADA, use: APO AE 09613-5000
>
>
> ***PRIVILEGED AND CONFIDENTIAL***
> The information contained in this e-mail message (including any attached 
> files) is intended for the use of the addressee(s) only and is priviliged 
> information. The information should neither be posted to the Internet, nor 
> published in any other public domain, without the express permission of the 
> sender. If you are not the intended recipient(s) or the recipient's 
> representative, you are hereby notified that any use, disclosure, copying or 
> distribution of this communication is prohibited. If you have received this 
> communication in error please notify us immediately at address@hidden, and 
> remove this message from your system.
>
>

===============================================================================
Robb Kambic                                Unidata Program Center
Software Engineer III                      Univ. Corp for Atmospheric Research
address@hidden             WWW: http://www.unidata.ucar.edu/
===============================================================================