[ncl-talk] Plot station data with NCL
Mary Haley
haley at ucar.edu
Wed Jul 8 14:59:27 MDT 2015
Stavros,
I think you have a syntax error. Your array is 3004 x 5. Remember that
dimension numbering in NCL starts at 0, so to access columns 2,3 and 5, you
need:
station = asciiread(ascii_filename,(/3004,5/),"float")
x = station(:,2) ; Column 3 of file contains X values.
y = station(:,1) ; Column 2 of file contains Y values.
z = station(:,4) ; Column 5 of file contains Z values.
Also make sure that your "x" values are the longitude values, and "y" is
latitude.
I'm in a conference this week, so not on email much. I will try to look for
further emails and respond faster.
--Mary
On Sun, Jul 5, 2015 at 4:55 AM, Stavros Dafis <sdafis at cc.uoi.gr> wrote:
> First of all, happy Independence day to all American users. Secondly,
> thank you
> for your prompt replies.
>
> I am sorry that I did not make myself clear, I need to regrid my data and
> then
> make a shaded contour plot. For instance, I have a txt file with lat/lon
> and
> rain gauge values. By "decent manner" I mean that NCL triangular mesh
> interpolation VS GrADS station interpolation is very bad. Also, the plot
> examples with coloured dots are not convenient when you have thousands of
> stations.
>
> These guys in Meteonetwork use natgrid in NCL to plot station data with
> excellent results:
> http://www.meteonetwork.it/rete/mappe.php?region=
>
> So I decided to plot my data this way, but with no success..
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> begin
> ascii_filename = "12h_totalrain_with_id.txt"
> station = asciiread(ascii_filename,(/3004,5/),"float")
> x = station(:,3) ; Column 3 of file contains X values.
> y = station(:,2) ; Column 2 of file contains Y values.
> z = station(:,5) ; Column 5 of file contains Z values.
> numxout = 21 ; Define output grid for call to "natgrids".
> numyout = 21
> xmin = min(x)
> ymin = min(y)
> xmax = max(x)
> ymax = max(y)
> xc = (xmax-xmin)/(numxout-1)
> yc = (ymax-ymin)/(numyout-1)
> xo = xmin + ispan(0,numxout-1,1)*xc
> yo = ymin + ispan(0,numyout-1,1)*yc
>
> zo = natgrid(x, y, z, xo, yo) ; Interpolate.
>
>
> The problem seems to be at the 5th column (rain data) according to NCL but
> I
> can't figure it out..
>
>
> Thank you for your time,
>
>
> Stavros
>
>
>
>
> Quoting Mary Haley <haley at ucar.edu>:
>
> > Stavros,
> >
> > In what manner do you need to plot the station data? Do you mean like
> the
> > weather plots that Dennis pointed you to, or do you actually need to
> regrid
> > the data and then generate something like a contour plot?
> >
> > Here's is a "station data" examples page, but as you pointed out, some of
> > these examples are rather simplistic:
> >
> > http://www.ncl.ucar.edu/Applications/station.shtml
> >
> > It would help if you could be more specific about what you need.
> >
> > --Mary
> >
> >
> > On Fri, Jul 3, 2015 at 10:47 AM, Stavros Dafis <sdafis at cc.uoi.gr> wrote:
> >
> > > Hi everyone,
> > >
> > > I am Stavros from Greece, a new user of NCL and I would like to ask
> you if
> > > you
> > > have managed to plot station data via NCL in a decent manner.
> Meteonetwork
> > > in
> > > Italy uses natgrid interpolation in NCL and plots rain from station
> data
> > > very
> > > nice but I haven't managed to do so. In UCAR's page the examples are
> too
> > > simple
> > > and they are useless if you have many data. I want to plot about 4000
> > > station
> > > data in West Europe..
> > >
> > > Stavros Dafis
> > > MSc student Atmospheric Sciences and Environment
> > > University of Ioannina
> > > _______________________________________________
> > > ncl-talk mailing list
> > > ncl-talk at ucar.edu
> > > List instructions, subscriber options, unsubscribe:
> > > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> > >
> >
>
>
> Stavros Dafis
> MSc student Atmospheric Sciences and Environment
> University of Ioannina
> Tel: +30 2651008499, Mobile: +30 6970420242
> e-mails: sdafis at noa.gr or dafis91 at yahoo.gr or sdafis at cc.uoi.gr
> Weather charts: http://www.metar.gr
> http://www.meteovolos.gr
> Photos: https://www.flickr.com/photos/22498448@N04/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150708/5e9f09f8/attachment.html
More information about the ncl-talk
mailing list