Re: Changing latitude/longitude to simple x/y coordinates

From: Wee-Beng Tay <zonexo_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 20 2010 - 20:26:03 MDT

Hi Dave,

Thanks for your advice. It worked!

On Tue, Apr 20, 2010 at 3:50 AM, Dave Allured <dave.allured@noaa.gov> wrote:

> Wee-Beng Tay,
>
> Are you using one of the GSN plot subroutines like this?
>
> plot = gsn_csm_contour (wks, data, res)
>
> If so, then the coordinates are attached to the data variable, and
> my first advice was incomplete. There are coordinate variables
> attached to the data variable. You must change the units strings on
> the ATTACHED coordinates, not separate copies, like this:
>
> data = f->var ; example; read data into a 2-D memory array
>
> delete (data&lat@units)
> delete (data&lon@units)
>
> plot = gsn_csm_contour_map_ce (wks, data, res)
>
> Change the names data, lat, and lon to match exactly what you are
> using in your program.
>
> For transformation, you can work with the objects "data&lat" and
> "data&lon" as if they are simple 1-D numeric arrays, unless you have
> one of the special coordinate types. E.g.
>
> data&lon = -1100 + data&lon * 1100 / 222
>
> If this does not work right, then we can't find the problem without
> more information. Please post the information suggested by Dennis,
> also the exact plot commands that you are using. Good luck.
>
> --Dave A.
> NOAA/PSD/CIRES
>
> On 4/19/2010 2:02 AM, Wee-Beng Tay wrote:
> > Hi Dave,
> >
> > Thanks. Ya, the attributes are degrees_north and degrees_east.
> >
> > I tried what you suggested:
> >
> > lat_uv = a->latitude
> > lon_uv = a->longtitude
> >
> > delete (lon_uv@units)
> > delete (lat_uv@units)
> >
> > but it can't work. There's still E and N shown. However, there's no error
> > msg.
> >
> > I tried:
> >
> > lat_uv@units = "kilometers"
> > lon_uv@units = "kilometers"
> >
> > but it can't work as well.
> >
> > I then had to edit the code to produce "kilometers" as the unit and the
> > problem is solved. But I hope that it can be done thru NCL as well, if
> > there's a way.
> >
> > However, how do I shift the X/Y e.g. from 0 - 220 to -1100 to 0. I tried
> :
> >
> > lon_uv = -1100+lon_uv*1100/222
> >
> > but it can't work. I remember that something else had to be done but I
> tried
> > to search and can't find an answer.
> >
> > Can you help?
> >
> > Thanks alot!
> >
> > On Sun, Apr 18, 2010 at 5:08 AM, Dave Allured<dave.allured@noaa.gov>
> wrote:
> >
> >> I think that the units attributes on your x and y variables are
> >> causing the E and N suffixes. Are these attributes degrees_north
> >> and degrees_east?
> >>
> >> In NCL, try deleting the units attributes from in-memory copies of x
> >> and y, before plotting:
> >>
> >> delete (x@units)
> >> delete (y@units)
> >>
> >> --Dave A.
> >> NOAA/PSD/CIRES
> >>
> >> On 4/16/2010 11:54 PM, Wee-Beng TAY wrote:
> >>> Hi,
> >>>
> >>> I have a netcdf data file which has latitude and longitude components.
> >>> However these latitude and longitude are only Y/X values.
> >>>
> >>> When I plot using NCL, they appear as 60E, 120N. However I only want
> >>> them to appear as numbers, and if possible, do some scaling and
> shifting
> >>> e.g.:
> >>>
> >>> new x = 10.*(old x)+20.
> >>>
> >>> How can I do that?
> >>>
> >>> Thanks alot!
> >>> _______________________________________________
> >>> 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
> >>
> >
> >
> >
> > _______________________________________________
> > 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
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Apr 20 20:26:12 2010

This archive was generated by hypermail 2.1.8 : Fri Apr 23 2010 - 14:40:07 MDT