Re: give tick marks on a longitude-time plot

From: Yi-Chih Huang <dscpln_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 07 2013 - 16:08:31 MST

Mary,

    Because year is the name of directories in my current working
environment, "/" and string setting are necessary to work on directory in
the script as follows.

dir1= "/fs3/SysE_DB/saji/OISST/Monthly/Mean/"
dir2=
(/"1981/","1982/","1983/","1984/","1985/","1986/","1987/","1988/","1989/",\

"1990/","1991/","1992/","1993/","1994/","1995/","1996/","1997/","1998/","1999/","2000/",\
          "2001/","2002/","2003/","2004/","2005/","2006/","2007/","2008/"/)
dir = str_concat(dir1+dir2(0))

    As for the ind statement below, I don't understand why it is "yStrt =
(/"1981/","1985/","1996/"/)", rather than "yStrt =
(/"1982/","1986/","1997/"/)" to select the year 1982-83, 1986-87, and
1997-98. What do you think of this?

yStrt = (/"1981/","1985/","1996/"/)
yLast = (/"1983/","1987/","1998/"/)
iYr = ind(YMDHMS(:,0).ge.yStrt(ny) .and. YMDHMS(:,0).le.yLast(ny))

    Thanks much,

                    Yi-Chih

On Fri, Nov 8, 2013 at 12:17 AM, Mary Haley <haley@ucar.edu> wrote:

> Yi-Chih,
>
> These two lines really don't make sense:
>
> > yStrt = (/"1981/","1985/","1996/"/)
> > yLast = (/"1983/","1987/","1998/"/)
>
> Why do you have these as strings and not integers? Also, why do you have
> the extra "/" after the year values?
>
> I think these two lines should be integers, because they eventually are
> being compared against float values, not string values.
>
> > yStrt = (/1981,1985,1996/)
> > yLast = (/1983,1987,1998/)
>
> --Mary
>
>
> On Nov 6, 2013, at 6:43 PM, Yi-Chih Huang <dscpln@gmail.com> wrote:
>
> > Mary,
> >
> > I used pcps!0= "year" to remove the warning. Besides, I want to
> choose 1982-83, 1986-87, and 1997-98. At first I believed the command
> yStrt = (/"1982/","1986/","1997/"/) would have chosen the years 1982-83,
> 1986-87, and 1997-98. However, it is yStrt = (/"1981/","1985/","1996/"/)
> which was working. Could you explain why yStrt =
> (/"1982/","1986/","1997/"/) only chose the year 1983?
> >
> > yStrt = (/"1981/","1985/","1996/"/)
> > yLast = (/"1983/","1987/","1998/"/)
> > iYr = ind(YMDHMS(:,0).ge.yStrt(ny) .and. YMDHMS(:,0).le.yLast(ny))
> >
> > Thanks much,
> >
> > Yi-Chih
> >
> >
> > On Thu, Nov 7, 2013 at 2:32 AM, Mary Haley <haley@ucar.edu> wrote:
> > You are getting these warnings because you are using a _Wrap function on
> "pcps", which has no metadata.
> >
> > The _Wrap functions are supposed to be used when you have metadata that
> you want to retain.
> >
> > I believe when you do something like this:
> >
> > > pcps(ny,:,:)= dim_avg_n_Wrap( preci,1 ) ; (time,lat)
> >
> > since the variable "pcps" already exists, and since you are using it in
> a subscripting fashion, NCL will not copy over any metadata.
> >
> > The warning is probably harmless, but you can also just use "dim_avg_n",
> and then use copy_VarMeta to copy metadata to pcps later.
> >
> > --Mary
> >
> > On Nov 5, 2013, at 1:01 AM, Yi-Chih Huang <dscpln@gmail.com> wrote:
> >
> > > Hello,
> > >
> > > I modified Dennis' script to calculate anomies. I don't
> understand why there is "Coordinate variables" problem, especially I copy
> variable coordinate to the variable in the Hovmoller diagram and didn't
> change the commands about time axis. In addition, I executed
> "dimsizes(pcps)". Why does the warning "warning:Dimension (0) has not been
> defined" still show up?
> > >
> > > Thanks,
> > >
> > > Yi-Chih
> > >
> > > ########
> > > yhuang@arc-env:/fs3/yhuang/scripts$ ncl pcpSstTime.ncl
> > > Copyright (C) 1995-2013 - All Rights Reserved
> > > University Corporation for Atmospheric Research
> > > NCAR Command Language Version 6.1.2
> > > The use of this software is governed by a License Agreement.
> > > See http://www.ncl.ucar.edu/ for more details.
> > > (0) a
> > > warning:Dimension (0) has not been defined
> > > (0) b
> > > fatal:Coordinate variables must be the same dimension as their
> dimension
> > > fatal:No coordinate variable exists for dimension (time) in variable
> (dpcp)
> > > fatal:["Execute.c":8128]:Execute: Error occurred at or near line 89 in
> file pcpSstTime.ncl
> > >
> > > ###
> > > load "$SysE/lib/ncl/helper_libs.ncl"
> > >
> > > begin
> > > latS = -5.0
> > > latN = 5.0
> > > lonE = 120.0
> > > lonW = 280.0
> > >
> > > yrStrt = 1979
> > > yrLast = 2009
> > >
> > > in = addfile("/fs3/yhuang/precip.mon.mean.nc","r") ;
> 197901-201306
> > > YMDHMS = cd_calendar(in->time, 0) ; all times
> > > ; index for desired time
> > > iYear = ind(YMDHMS(:,0).ge.yrStrt .and. YMDHMS(:,0).le.yrLast)
> > > ; read time and region
> > > precip = in->precip(iYear,{latS:latN},{lonE:lonW})
> > > pcpClm = clmMonTLL( precip )
> > >
> > > xt= precip(0:23,{latS:latN},{lonE:lonW})
> > > ds= dimsizes(xt)
> > > nyr= yrLast -yrStrt +1
> > > pcpm= new((/ds(0),ds(2)/),float)
> > >
> > > yyyymmM = cd_calendar(precip&time,-1) ; verify times are
> correct
> > >
> > > dimp = dimsizes(precip)
> > > ntim = dimp(0)
> > > nlat = dimp(1)
> > > mlon = dimp(2)
> > >
> > > pcpt = dim_avg_n_Wrap( pcpClm,1 ) ; (time,lat)
> > > do nm= 0,11
> > > pcpm(nm,:) = pcpt(nm,:)
> > > pcpm(nm+12,:)= pcpt(nm,:)
> > > end do
> > >
> > > yStrt = (/"1981/","1985/","1996/"/)
> > > yLast = (/"1983/","1987/","1998/"/)
> > > nyrs= dimsizes(yStrt)
> > >
> > > in= addfile("/fs3/yhuang/precip.mon.mean.nc","r") ; 197901-201306
> > > prec= in->precip
> > > xt= prec(0:23,{latS:latN},{lonE:lonW})
> > > ds= dimsizes(xt)
> > > pcps= new((/nyrs,ds(0),ds(2)/),float)
> > >
> > > do ny= 0,nyrs-1 ; precipitation in ENSO years
> > > iYr = ind(YMDHMS(:,0).ge.yStrt(ny) .and. YMDHMS(:,0).le.yLast(ny))
> > > ; read time and region
> > > preci = in->precip(iYr,{latS:latN},{lonE:lonW})
> > >
> > > yyyymmE = cd_calendar(preci&time,-1) ; verify times are
> correct
> > >
> > > dimp = dimsizes(preci)
> > > ntim = dimp(0)
> > > nlat = dimp(1)
> > > mlon = dimp(2)
> > >
> > > pcps(ny,:,:)= dim_avg_n_Wrap( preci,1 ) ; (time,lat)
> > > end do
> > >
> > > dimp = dimsizes(pcps)
> > > ntim = dimp(0)
> > > print("a")
> > > pcpE= dim_avg_n_Wrap( pcps, 0 )
> > > print("b")
> > > dpcp= pcpE - pcpm
> > > copy_VarCoords(pcpE,dpcp)
> > >
> > > wks= gsn_open_wks("X11","pcpa")
> > > gsn_define_colormap(wks,"BlueRed")
> > >
> > > res = True
> > > res@gsnAddCyclic = False
> > >
> > > res@cnFillOn = True
> > > res@cnLinesOn = False ; turn off the
> contour lines
> > > res@cnLineLabelsOn = False
> > > res@cnSpanFillPalette = True
> > >
> > > res@gsnSpreadColors = True ; use full colormap
> > > res@gsnSpreadColorStart = 10 ; for BlueRed
> > > res@gsnSpreadColorEnd = 250 ; for BlueRed
> > >
> > > yr= ispan(1,ntim,1)
> > > yr@long_name = "months"
> > > delete(dpcp&time)
> > > dpcp&time = yr
> > > plot = gsn_csm_hov(wks,dpcp,res)
> > > end
> > > _______________________________________________
> > > 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 Thu Nov 7 16:09:00 2013

This archive was generated by hypermail 2.1.8 : Mon Nov 11 2013 - 09:45:33 MST