[ncl-talk] gsn_add_polygon function

Alan Brammer abrammer at albany.edu
Sun Mar 1 11:50:11 MST 2015


oh if your data only has 12 time dimensions then you can possibly switch
out y1&time at lines 77/78 with an array of 1-12.

The below would  rely on the nmes always being 12, or I'm sure you can make
it more robust, based on the needs.

dummytime = ispan(1,12,1)
do k=0,nmes-1
   yp(k)              = y1(k) + dx
   xp(k)              = dummytime(k)
   xp(sigma*nmes-1-k) = dummytime(k)
   yp(sigma*nmes-1-k) = y1(k) - dx
end do


On Sun, Mar 1, 2015 at 1:43 PM, Guilherme Martins <jgmsantos at gmail.com>
wrote:

> Hi Alan,
>
> I'll take a look in your sugestion. Thanks.
>
> The informations about my file using the ncdump
>
> netcdf fluxos.ERAI {
> dimensions:
> lon = 1 ;
> lat = 1 ;
> time = UNLIMITED ; // (12 currently)
> variables:
> double lon(lon) ;
> lon:standard_name = "longitude" ;
> lon:long_name = "longitude" ;
> lon:units = "degrees_east" ;
> lon:axis = "X" ;
> double lat(lat) ;
> lat:standard_name = "latitude" ;
> lat:long_name = "latitude" ;
> lat:units = "degrees_north" ;
> lat:axis = "Y" ;
> double time(time) ;
> time:standard_name = "time" ;
> time:units = "days since 1979-01-01 12:00:00" ;
> time:calendar = "standard" ;
> float fnorte(time, lat, lon) ;
> fnorte:code = 3 ;
> float fsul(time, lat, lon) ;
> fsul:code = 5 ;
> float fleste(time, lat, lon) ;
> fleste:code = 2 ;
> float foeste(time, lat, lon) ;
> foeste:code = 4 ;
> float fbalanco(time, lat, lon) ;
> fbalanco:code = 1 ;
>
> // global attributes:
> :CDI = "Climate Data Interface version 1.6.5 (
> http://code.zmaw.de/projects/cdi)" ;
> :Conventions = "CF-1.4" ;
> :history = "Sun Mar 01 01:16:49 2015: cdo -O -s merge norte.nc sul.nc
> leste.nc oeste.nc balanco.nc fluxos.ERAI.nc\n",
> "Sun Mar 01 01:16:44 2015: cdo -O -s -r -ymonmean -monmean
> -setcalendar,standard -settaxis,1979-01-01,12:00:00,1day -setcode,1
> -chname,var1,fbalanco balanco.tmp.nc balanco.nc\n",
> "Sun Mar 01 01:16:44 2015: cdo -O -s -f nc input,r1x1 balanco.tmp.nc" ;
> :CDO = "Climate Data Operators version 1.6.5 (
> http://code.zmaw.de/projects/cdo)" ;
> }
>
> Guilherme.
>
> *Guilherme Martins*
> https://sites.google.com/site/jgmsantos
>
>
> 2015-03-01 15:25 GMT-03:00 Alan Brammer <abrammer at albany.edu>:
>
> Hard to know without the file information.
>> It looks like your plotting the data on ax axis of  1-12.  The x points
>> of your polygon therefore need to be with respect to this 1-12 axis.
>> Whereas you're defining them based on the time coordinate of your data
>> which I presume is not 1-12 currently.
>>
>> Either scale the x coordinates of the polygon to match the 1-12 axis or
>> change the plot to be with respect to y1&time.
>>
>> Throw a print(xp)  between line 81 and the end and if the values are not
>> between 1-12 then the polygon is being plotted but somewhere else not
>> within the plot bounds.
>>
>> Hopefully that makes sense.
>>
>>
>> ~Alan.
>>
>>
>> On Sun, Mar 1, 2015 at 12:08 PM, Guilherme Martins <jgmsantos at gmail.com>
>> wrote:
>>
>>> Hi NCL users!
>>>
>>> I'm trying to insert shaded area in my dataset observed using the
>>> gsn_add_polygon function, but I'm not getting. I don't get errors and the
>>> shaded area don't appear.
>>>
>>> My files are in attached.
>>>
>>> I'm using ncl 6.2.1.
>>>
>>> Any help is very appreciated.
>>>
>>> *Guilherme Martins*
>>> https://sites.google.com/site/jgmsantos
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150301/5cba434a/attachment.html 


More information about the ncl-talk mailing list