[ncl-talk] help

Alan Brammer abrammer at albany.edu
Tue Sep 8 07:48:21 MDT 2015


 sst(time.lat,lon)
* sst(ind_warm)*
You're defining a 3d variable with only 1 dimension.  What do you want to
happen with the spatial dimensions ?

You need to reference the lat and the lon dimension in some form.
sst(ind_warm, :, :)   ;; select the whole grid.

Now y is still 3 dimensions. Which you're not going to be able to plot in
any meaningful way on an xy plot.
y = dim_avg_n_Wrap( sst(ind_warm, :, :) , (/1,2/) )  ;; Now you have a
global average for each "warm year"

Good luck.



On Tue, Sep 8, 2015 at 9:42 AM, afwande juliet <afwandej965 at gmail.com>
wrote:

> Hello
>
> I am doing timeseries for Warm years for sst and CMAP data.
> how do i make the left and right dimension be same especilly here........ *
> y       = sst(ind_warm*).........see it in main script.
> it complains about left and right dimension not same. my data is
> sst(time.lat,lon) and am plotting only warm years
>  thanks
>
> below is script
>
> begin
> ;************************************************
> ; Read in data
> ;************************************************
>   f     = addfile ("sst.mnmean.nc","r")
>   time  = f->time                                 ; access date
>   sst   = (f->sst)*0.1                            ; scale sst anomalies
> ;************************************************
> ; extract warm years from data
> ;************************************************
>   warm_yrs  = (/1951,1953,1957,1963,1965,1969,1972,1976,1982,1987,1991/)
>   warm_time_yrs = warm_yrs * 100 + 01             ; match format of date
> array
>   nwarm     = dimsizes(warm_yrs)                  ; how many warm years
>   ind_warm  = new(nwarm,integer)                  ; create array
>   do n=0,nwarm-1
>     ind_warm(n)  = ind(warm_time_yrs(n).eq.time)
>   end do
>  * y       = sst(ind_warm)*
>   x     = ispan(0,nwarm-1,1)
> ;************************************************
> ; create plot
> ;************************************************
>   wks   = gsn_open_wks ("x11","xy")                ; open ps file
>   res               = True                        ; plot mods desired
>
>   res at tmXBMode          = "Explicit"              ; explicit labels
>   res at tmXBValues        = x                       ; location of labels
>   res at tmXBLabels        = warm_yrs                ; labels themselves
>   res at tmLabelAutoStride = True                    ; nice stride on labels
>   res at tiMainString      = "Explicit axis labeling"; title
>   plot  = gsn_csm_xy(wks,x,y,res)
> end
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20150908/e9f8e244/attachment.html 


More information about the ncl-talk mailing list