On Sep 13, 2012, at 7:42 AM, Andrea N. Hahmann wrote:
> Hello In the NCL function "latlon2utm" is it possible to set the grid zone (I need "32U")?
Hi Andrea,
I had to look at the code to see what's allowed. From what I can tell, there's no recognition of "32":
In the code below "zone_long" comes from the first two characters of "grid_zone", and "zone_lat" comes from the 3rd character. Note that it prints an error if you give it "32":
zone_long = (grid_zone[0] - '0') * 10 + (grid_zone[1] - '0');
zone_lat = grid_zone[2];
/* Take care of special cases */
switch(zone_lat) {
case 'A': case 'B': case 'Y': case 'Z':
*lambda0 = 0;
return(0);
break;
case 'V':
switch (zone_long) {
case 31:
*lambda0 = 1.5 * M_PI / 180.0;
return(0);
break;
case 32:
*lambda0 = 7.5 * M_PI / 180.0;
return(0);
break;
break;
}
case 'X':
switch (zone_long) {
case 31:
*lambda0 = 4.5 * M_PI / 180.0;
return(0);
break;
case 33:
*lambda0 = 15 * M_PI / 180.0;
return(0);
break;
case 35:
*lambda0 = 27 * M_PI / 180.0;
return(0);
break;
case 37:
*lambda0 = 37.5 * M_PI / 180.0;
return(0);
break;
case 32: case 34: case 36:
NhlPError(NhlWARNING,NhlEUNKNOWN,"utm2latlon/latlon2utm: Zone %02d%c does not exist!\n",zone_long, zone_lat);
return(-1);
break;
}
I don't recall at the moment where this code came from, or why cases 32, 34, and 36 produce an error. If you know the proper calculation, I can easily add it.
--Mary
> This is possible in the reverse function "utm2latlon". From the function documentation:
> xy = (/285039.989723,3776960.118351/)
>
> xy@grid_zone = "11S"
>
>
>
> latlon =
>
> utm2latlon(xy,0) ; 34.113, -119.331
>
>
> Thanks,
> Andrea
>
> ----
> Andrea N. Hahmann
> Senior Scientist
> DTU Wind Energy
>
> Technical University of Denmark
> Risų Campus
> Frederikborgvej 399, P.O. Box 49
> 4000 Roskilde, Denmark
>
> Direct +45 4677 5471
> Mobil: +45 2133 0550
> ahah@dtu.dk
> http://www.vindenergi.dtu.dk/
>
>
>
> _______________________________________________
> 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 Mon Sep 17 09:44:37 2012
This archive was generated by hypermail 2.1.8 : Fri Sep 21 2012 - 16:22:30 MDT