[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?



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.

Attached is latest cdl.

Robb...



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
>
>
> Robb Kambic wrote:
> >
> > On Fri, 26 Mar 2004, Richard Signell wrote:
> >
> > > Robb,
> > >
> > > Does this mean that the produced netcdf would have the
> > > true lon/lat values added as 2D arrays, e.g. something
> > > like this:
> > >
> > Rich,
> >
> > This is the aim, but I'm still having problems getting the tranforms
> > correct. The Di and Dj values are valid on the tranformed values, the
> > initial grid has variable spacing. Also, the rotation angle is 0, so
> > the grid is just slid to the polar coordinates.  The main guy is out of
> > town until next week so I'll put it on hold until his input.
> >
> > Thanks for your patience,
> > Robb..
> >
> > >
> > > netcdf dwd_lokal {
> > > dimensions:
> > >         time = UNLIMITED ; // (13 currently)
> > >         j = 205 ;
> > >         i = 187 ;
> > > variables:
> > >
> > >       float lat_pole(j) ;
> > >                 lat_pole:long_name = "latitude in rotated pole
> > > coordinates" ;
> > >         float lon_pole(i) ;
> > >                 lon_pole:long_name = "longitude in rotated pole
> > > coordinate" ;
> > >         float lat(j, i) ;
> > >                 lat:units = "degrees_north" ;
> > >                 lat:long_name = "latitude" ;
> > >         float lon(j, i) ;
> > >                 lon:units = "degrees_east" ;
> > >                 lon:long_name = "longitude" ;
> > >         short U10(time, j, i) ;
> > >                 U10:long_name = "Eastward wind component" ;
> > >                 U10:units = "m/s" ;
> > >                 U10:scale_factor = 0.001525925f ;
> > >                 U10:add_offset = 0.f ;
> > >                 U10:coordinates = "lon lat" ;
> > >         short V10(time, j, i) ;
> > >                 V10:long_name = "Northward wind component" ;
> > >                 V10:units = "m/s" ;
> > >                 V10:scale_factor = 0.001525925f ;
> > >                 V10:add_offset = 0.f ;
> > >                 V10:coordinates = "lon lat" ;
> > >         double time(time) ;
> > >                 time:units = "days since 1968-5-23" ;
> > >                 time:long_name = "modified julian day (ROMS-style)" ;
> > >
> > >
> > > > >
> > > > I didn't have a full understanding of rotated lon/lat grids until I 
> > > > talked
> > > > with my co-workers. Now I can probably code the the creation of the
> > > > lat/lon part of the cdl.
> > > >
> > > > Robb...
> > > >
> > >
> > > --
> > > 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/
> > ===============================================================================
>
> --
> 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/
===============================================================================
netcdf Replace_with_model_name{ 


dimensions:
        record = UNLIMITED ;   // (reference time, forecast time)
        lat = 272 ;            // latitude
        lon = 234 ;            // longitude
        bls = 1 ;              // depth below land surface
        time_len = 21 ;        // string length for datetime strings
        valtime_offset = 1 ;   // number of offset times
        nmodels = 1 ;          // number of models
        ngrids = 1 ;           // number of grids
        nav = 1 ;              // for navigation
        nav_len = 100 ;        // max string length for navigation strings

variables:

        double reftime(record) ;        // reference time of the model
               reftime:long_name = "reference time" ;
               reftime:units = "hours since 1992-1-1" ;

        double valtime(record) ;        // forecast time ("valid" time)
               valtime:long_name = "valid time" ;
               valtime:units = "hours since 1992-1-1" ;

        :record = "reftime, valtime" ;  // "dimension attribute" -- means
                                        // (reftime, valtime) uniquely
                                        // determine record

        char   datetime(record, time_len) ; // derived from reftime
               datetime:long_name = "reference date and time" ;
               // units YYYY-MM-DD hh:mm:ssZ  (ISO 8601)

        double valtime_offset(valtime_offset) ; // valtime - reftime
               valtime_offset:long_name = "hours from reference time" ;
               valtime_offset:units = "hours" ;

        char   forecasttime(record, time_len) ; // derived from valtime
               forecasttime:long_name = "forecast date and time" ;
               // units YYYY-MM-DD hh:mm:ssZ  (ISO 8601)

        float  bls(bls) ;
               bls:long_name = "depth below land surface" ;
               bls:units = "cm" ;


        // The following lat and lon coordinate variables are redundant,
        // since the navigation variables provide the necessary information.
        // The extra information is included here for human readability.

        float  lat(lat) ;
               lat:long_name = "latitude" ;
               lat:units = "degrees_north" ;

        float  lon(lon) ;
               lon:long_name = "longitude" ;
               lon:units = "degrees_east" ;

        long   model_id(nmodels) ;
               model_id:long_name = "generating process ID number" ;

        // navigation variables all use nav dimension

        char   nav_model(nav, nav_len) ;        // navigation parameterization
               nav_model:long_name = "navigation model name" ;

        int    grid_type_code(nav) ;
               grid_type_code:long_name = "GRIB-1 GDS data representation type" 
;

        char   grid_type(nav, nav_len) ;
               grid_type:long_name = "GRIB-1 grid type" ;

        char   grid_name(nav, nav_len) ;
               grid_name:long_name = "grid name" ;

        int    grid_center(nav) ;
               grid_center:long_name = "GRIB-1 originating center ID" ;

        int    grid_number(nav, ngrids) ;
               grid_number:long_name = "GRIB-1 catalogued grid numbers" ;
               grid_number:_FillValue = -9999 ;

        char   i_dim(nav, nav_len) ;
               i_dim:long_name = "longitude dimension name" ;

        char   j_dim(nav, nav_len) ;
               j_dim:long_name = "latitude dimension name" ;

        int    Ni(nav) ;
               Ni:long_name = "number of points along a latitude circle" ;

        int    Nj(nav) ;
               Nj:long_name = "number of points along a longitude circle" ;

        float  La1(nav) ;
               La1:long_name = "latitude of first grid point" ;
               La1:units = "degrees_north" ;

        float  Lo1(nav) ;
               Lo1:long_name = "longitude of first grid point" ;
               Lo1:units = "degrees_east" ;

        float  La2(nav) ;
               La2:long_name = "latitude of last grid point" ;
               La2:units = "degrees_north" ;

        float  Lo2(nav) ;
               Lo2:long_name = "longitude of last grid point" ;
               Lo2:units = "degrees_east" ;

        float  Di(nav) ;
               Di:long_name = "longitudinal direction increment" ;
               Di:units = "degrees" ;

        float  Dj(nav) ;
               Dj:long_name = "latitudinal direction increment" ;
               Dj:units = "degrees" ;

        float  RotAngle(nav) ;
               RotAngle:long_name = "Angle of rotation" ;
               RotAngle:units = "degrees" ;

        float  RotLat(nav) ;
               RotLat:long_name = "Lat of S. pole of rotation" ;
               RotLat:units = "degrees" ;

        float  RotLon(nav) ;
               RotLon:long_name = "Lon of S. pole of rotation" ;
               RotLon:units = "degrees" ;

        byte   ResCompFlag(nav) ;
               ResCompFlag:long_name = "resolution and component flags" ;

        // end of navigation variables

        float  T_soil_bls(record,bls,lat,lon) ;
               T_soil_bls:long_name = "Soil temperature at depth below land 
surface" ;
               T_soil_bls:GRIB_parameter_number = 85 ;
               T_soil_bls:GRIB_level_flag = 111 ;
               T_soil_bls:units = "degK" ;
               T_soil_bls:_FillValue = -9999.f ;
               T_soil_bls:navigation = "nav" ;


// global attributes
               :history = "2004-03-29 12:37:57 - created by gribtocdl" ; 
               :title = "Enter model definition here" ;
               :Conventions = "NUWG" ;
               :GRIB_reference = "Office Note 388 GRIB" ;
               :GRIB_URL = "http://www.nco.ncep.noaa.gov/pmb/docs/on388/"; ;
               :version = 0.0 ;

data:

 bls = 0.0 ;
 model_id = 131 ;
 valtime_offset = 0 ;


 // Navigation
 nav_model = "GRIB1" ;
 grid_type_code = 10 ;
 grid_type = "Rotated latitude/longitude" ;
 grid_name = " " ;
 grid_center = 200 ;
 grid_number = 255 ;
 i_dim = "lon" ;
 j_dim = "lat" ;
 Ni = 234 ;
 Nj = 272 ;
 La1 = -24.000000 ;
 Lo1 = -5.000000 ;
 La2 = -7.063000 ;
 Lo2 = 9.563000 ;
 Di = 65.535004 ;
 Dj = 65.535004 ;
 RotLat = -32.500000 ;
 RotLon = 10.000000 ;
 RotAngle = 0.000000 ;
 ResCompFlag = 0 ;

 lon = 10.00, 10.07, 10.13, 10.20, 10.26, 10.33, 10.39, 10.46,
       10.52, 10.59, 10.66, 10.72, 10.79, 10.85, 10.92, 10.98,
       11.05, 11.11, 11.18, 11.25, 11.31, 11.38, 11.44, 11.51,
       11.57, 11.64, 11.70, 11.77, 11.83, 11.90, 11.97, 12.03,
       12.10, 12.16, 12.23, 12.29, 12.36, 12.42, 12.49, 12.56,
       12.62, 12.69, 12.75, 12.82, 12.88, 12.95, 13.01, 13.08,
       13.15, 13.21, 13.28, 13.34, 13.41, 13.47, 13.54, 13.60,
       13.67, 13.74, 13.80, 13.87, 13.93, 14.00, 14.06, 14.13,
       14.19, 14.26, 14.33, 14.39, 14.46, 14.52, 14.59, 14.65,
       14.72, 14.78, 14.85, 14.92, 14.98, 15.05, 15.11, 15.18,
       15.24, 15.31, 15.37, 15.44, 15.50, 15.57, 15.64, 15.70,
       15.77, 15.83, 15.90, 15.96, 16.03, 16.09, 16.16, 16.23,
       16.29, 16.36, 16.42, 16.49, 16.55, 16.62, 16.68, 16.75,
       16.82, 16.88, 16.95, 17.01, 17.08, 17.14, 17.21, 17.27,
       17.34, 17.41, 17.47, 17.54, 17.60, 17.67, 17.73, 17.80,
       17.86, 17.93, 18.00, 18.06, 18.13, 18.19, 18.26, 18.32,
       18.39, 18.45, 18.52, 18.59, 18.65, 18.72, 18.78, 18.85,
       18.91, 18.98, 19.04, 19.11, 19.17, 19.24, 19.31, 19.37,
       19.44, 19.50, 19.57, 19.63, 19.70, 19.76, 19.83, 19.90,
       19.96, 20.03, 20.09, 20.16, 20.22, 20.29, 20.35, 20.42,
       20.49, 20.55, 20.62, 20.68, 20.75, 20.81, 20.88, 20.94,
       21.01, 21.08, 21.14, 21.21, 21.27, 21.34, 21.40, 21.47,
       21.53, 21.60, 21.67, 21.73, 21.80, 21.86, 21.93, 21.99,
       22.06, 22.12, 22.19, 22.25, 22.32, 22.39, 22.45, 22.52,
       22.58, 22.65, 22.71, 22.78, 22.84, 22.91, 22.98, 23.04,
       23.11, 23.17, 23.24, 23.30, 23.37, 23.43, 23.50, 23.57,
       23.63, 23.70, 23.76, 23.83, 23.89, 23.96, 24.02, 24.09,
       24.16, 24.22, 24.29, 24.35, 24.42, 24.48, 24.55, 24.61,
       24.68, 24.75, 24.81, 24.88, 24.94, 25.01, 25.07, 25.14,
       25.20, 25.27, 25.34, 25.40, 25.47, 25.53, 25.60, 25.66,
       25.73, 25.79, 25.86, 25.92, 25.99, 26.06, 26.12, 26.19,
       26.25, 26.32, 26.38, 26.45, 26.51, 26.58, 26.65, 26.71,
       26.78, 26.84, 26.91, 26.97, 27.04, 27.10, 27.17, 27.24,
       27.30, 27.37, 27.43, 27.50, 27.56, 27.63, 27.69, 27.76 ;

 lat =-32.50,-32.43,-32.37,-32.30,-32.24,-32.17,-32.11,-32.04,
      -31.98,-31.91,-31.84,-31.78,-31.71,-31.65,-31.58,-31.52,
      -31.45,-31.39,-31.32,-31.25,-31.19,-31.12,-31.06,-30.99,
      -30.93,-30.86,-30.80,-30.73,-30.67,-30.60,-30.53,-30.47,
      -30.40,-30.34,-30.27,-30.21,-30.14,-30.08,-30.01,-29.94,
      -29.88,-29.81,-29.75,-29.68,-29.62,-29.55,-29.49,-29.42,
      -29.35,-29.29,-29.22,-29.16,-29.09,-29.03,-28.96,-28.90,
      -28.83,-28.76,-28.70,-28.63,-28.57,-28.50,-28.44,-28.37,
      -28.31,-28.24,-28.17,-28.11,-28.04,-27.98,-27.91,-27.85,
      -27.78,-27.72,-27.65,-27.58,-27.52,-27.45,-27.39,-27.32,
      -27.26,-27.19,-27.13,-27.06,-27.00,-26.93,-26.86,-26.80,
      -26.73,-26.67,-26.60,-26.54,-26.47,-26.41,-26.34,-26.27,
      -26.21,-26.14,-26.08,-26.01,-25.95,-25.88,-25.82,-25.75,
      -25.68,-25.62,-25.55,-25.49,-25.42,-25.36,-25.29,-25.23,
      -25.16,-25.09,-25.03,-24.96,-24.90,-24.83,-24.77,-24.70,
      -24.64,-24.57,-24.50,-24.44,-24.37,-24.31,-24.24,-24.18,
      -24.11,-24.05,-23.98,-23.91,-23.85,-23.78,-23.72,-23.65,
      -23.59,-23.52,-23.46,-23.39,-23.33,-23.26,-23.19,-23.13,
      -23.06,-23.00,-22.93,-22.87,-22.80,-22.74,-22.67,-22.60,
      -22.54,-22.47,-22.41,-22.34,-22.28,-22.21,-22.15,-22.08,
      -22.01,-21.95,-21.88,-21.82,-21.75,-21.69,-21.62,-21.56,
      -21.49,-21.42,-21.36,-21.29,-21.23,-21.16,-21.10,-21.03,
      -20.97,-20.90,-20.83,-20.77,-20.70,-20.64,-20.57,-20.51,
      -20.44,-20.38,-20.31,-20.25,-20.18,-20.11,-20.05,-19.98,
      -19.92,-19.85,-19.79,-19.72,-19.66,-19.59,-19.52,-19.46,
      -19.39,-19.33,-19.26,-19.20,-19.13,-19.07,-19.00,-18.93,
      -18.87,-18.80,-18.74,-18.67,-18.61,-18.54,-18.48,-18.41,
      -18.34,-18.28,-18.21,-18.15,-18.08,-18.02,-17.95,-17.89,
      -17.82,-17.75,-17.69,-17.62,-17.56,-17.49,-17.43,-17.36,
      -17.30,-17.23 ;

}