[ncl-talk] Problem with gsn_add_text

Stavros Dafis sdafis at cc.uoi.gr
Mon Apr 17 12:48:31 MDT 2017


Dear Rick, thank you for your suggestion, I have tried to assign both the
FillValue and the missing value (@missing_value) but nothing seems to work.

I forgot to mention that I am using NCL 6.2.0, 6.3.0 and 6.4.0, on different
machines.


-- 
Stavros NTAFIS (DAFIS)
-----------------------------------------------
Physicist - Meteorologist, M.Sc.
Research Associate, National Observatory of Athens
(+33)9 81 94 22 12, Mobile: +30 697 04 20 242
---------------
Weather charts:
http://www.meteo.gr
http://www.meteo.gr/meteomaps/


Quoting Rick Brownrigg <brownrig at ucar.edu>:

> Hi Stavros,
>
> I don't know for certain, but I suspect you need to assign the _FillValue
> to the string array "points" that you constructed from "t2" (I don't see
> how the attributes from t2 would carry to points via the sprintf() ).
>
> Hope that helps...
> Rick
>
> On Sun, Apr 16, 2017 at 12:56 PM, Stavros Dafis <sdafis at cc.uoi.gr> wrote:
>
> > Hello everyone, I am facing a problem with the function gsn_add_text. In
> > the
> > description of the function, it is mentioned that no missing values will be
> > plotted:
> >
> > &#8220;This function attaches a list of text strings to the given plot.
> > The text
> > strings will be drawn only when the plot is drawn. If a missing value is
> > encountered in the text strings or x/y values, then no text string will be
> > drawn at this pair.&#8221;
> >
> > My script reads a netCDF file with 3 variables t2(lat,lon), lat(lat),
> > lon(lon),
> > so in order to attach values on the plot using this function, I have to
> > make
> > new 2-D variables for lat/lon and define the string to be plotted on the
> > map.
> > Values are assigned just fine on the plot, over the land, but missing
> > values
> > are also printed over the sea. I tried to use landsea masking but my data
> > have
> > high horizontal resolution (5km). Any suggestions?
> >
> > I have the same problem with WRF data, with already 2-D lat/lon arrays.
> >
> >  This is the part of the code which prints the values:
> > .
> > .
> > .
> > contour = gsn_csm_contour_map(wks,t2,res)
> >
> > t2 at missing_value = -1
> > t2 at _FillValue = -1
> > (default missing values = -999)
> >
> > lat2 = new(dimsizes(t2),typeof(lat),-1)
> > lon2 = new(dimsizes(t2),typeof(lon),-1)
> >
> > nb = dimsizes(t2)
> >
> > do nl=0,nb(0)-1,1
> > do ml=0,nb(1)-1,1
> >
> > lat2(nl,ml) = lat(nl)
> > lon2(nl,ml) = lon(ml)
> >
> > end do
> > end do
> >
> > points = sprintf("%3.0f", t2)
> > ;points = ""+t2(:,:)+""
> >
> > values = gsn_add_text(wks,contour,points,lon2(:,:),lat2(:,:),True)
> >
> >
> >
> > --
> > Stavros NTAFIS (DAFIS)
> > -----------------------------------------------
> > Physicist - Meteorologist, M.Sc.
> > Research Associate, National Observatory of Athens
> > (+33)9 81 94 22 12, Mobile: +30 697 04 20 242
> > ---------------
> > Weather charts:
> > http://www.meteo.gr
> > http://www.meteo.gr/meteomaps/
> >
> >
> >
> > _______________________________________________
> > ncl-talk mailing list
> > ncl-talk at ucar.edu
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >
>


More information about the ncl-talk mailing list