<div dir="ltr"><div><div><div><div><div>Possibly .....<br><br></div>After<br>        lat    = f-&gt;latitude<br>        lon    = f-&gt;longitude<br></div>Add<br></div>        lat!0 = &quot;lat&quot;<br></div>        lon!0 = &quot;lon&quot;<br><br></div>Good Luck<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 10, 2017 at 7:39 PM, Elaine Silva <span dir="ltr">&lt;<a href="mailto:laine.usp@gmail.com" target="_blank">laine.usp@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span id="m_6233283058916815993gmail-m_5600268266641284251gmail-result_box" class="m_6233283058916815993gmail-m_5600268266641284251gmail-" lang="en"><span class="m_6233283058916815993gmail-m_5600268266641284251gmail-">Dear ncl users</span><br><br><span class="m_6233283058916815993gmail-m_5600268266641284251gmail-">I&#39;m
 trying to use the mjoclivar_2.ncl script with daily total precipitation data 
from Era Interim, </span></span><span id="m_6233283058916815993gmail-m_5600268266641284251gmail-result_box" class="m_6233283058916815993gmail-m_5600268266641284251gmail-" lang="en"><span class="m_6233283058916815993gmail-m_5600268266641284251gmail-"><span class="m_6233283058916815993gmail-m_5600268266641284251gmail-" id="m_6233283058916815993gmail-m_5600268266641284251gmail-result_box" lang="en"><span class="m_6233283058916815993gmail-m_5600268266641284251gmail-">however an error is occurring</span></span></span><br><br><span>Could someone help me?</span> <span>Thank you very much in advance!</span></span><br><br>Variable: xAnom_sm<br>Type: float<br>Total Size: 951857280 bytes<br>            237964320 values<br>Number of Dimensions: 3<br>Dimensions and sizes:    [time | 1826] x [latitude | 181] x [longitude | 720]<br>Coordinates: <br>            time: [920436..964236]<br>            latitude: [-45..45]<br>            longitude: [-180..179.5]<br>Number Of Attributes: 3<br>  _FillValue :    -32767<br>  long_name :    Anomalies from Smooth Daily Climatology<br>  units :    m<br>(0)     <br>(0)    Anomalies from Smooth Daily Climatology: min=-0.0362034   max=0.329606<br>FileAddVar, in file: NclFile.c, line: 412<br>fatal:FileAddVar: Dimension (latitude) is not currently defined, can&#39;t add variable<br>fatal:[&quot;Execute.c&quot;:8578]:Execu<wbr>te: Error occurred at or near line 130 in file 01mjoelaine_2_pr.ncl<br><br></div>And the script<br><br>; ncl 01mjoelaine_2_pr.ncl<br><br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl&quot;  <br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl&quot;  <br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl&quot; <br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/diagnostics_<wbr>cam.ncl&quot;<br><br>begin<br>;-----------------------------<wbr>------------------------------<wbr>--<br>; User specifications<br>;-----------------------------<wbr>------------------------------<wbr>--<br>   NC      = True                          <wbr>   ; Deseja criar o arquivo netCDF? True = sim e False = não       <br>   PLOT    = False                         <wbr>   ; sample plots? Não cria figura<br><br>   ymdStrt = 20050101                      <wbr>   ; start yyyymmdd<br>   ymdLast = 20091231                      <wbr>   ; last  <br>   yrStrt  = ymdStrt/10000<br>   yrLast  = ymdLast/10000<br>  <br>   nhar    = 4                             <wbr>   ; number of fourier comp      <br><br>   var     = &quot;tp&quot;                          <wbr>  ; name of file. Nome da variável do seu arquivo de entrada<br>   vName   = &quot;TP&quot;                          <wbr>  ; name for plots. Nome da variável do arquivo netCDF que será gerado<br><br>  ;diri    = &quot;/project/cas/shea/CDC/&quot;      <wbr>   ; input directory   <br>   diri    = &quot;../../dados/diario/&quot;         <wbr>      ; input directory. Diretório de entrada dos dados<br>   fili    = var+&quot;.<a href="http://era.interim.2005.2009.invert.nc" target="_blank">era.interim.2005.2009.<wbr>invert.nc</a>&quot;       ; input file. Nome do arquivo a ser lido.       <br><br>   if (NC) then<br>       diro= &quot;./&quot;                          <wbr>   ; output dir. Onde será gerado o arquivo netCDF. &quot;./&quot; quer dizer no mesmo diretório do script<br>      ;filo= var+&quot;.<a href="http://day.anomalies.nc" target="_blank">day.anomalies.nc</a>&quot;       <wbr>   ; output file  <br>       filo= var+&quot;.day.anomalies.&quot;+yrStrt+&quot;<wbr>-&quot;+yrLast+&quot;.nc&quot;  ; output file. Nome do arquivo netCDF a ser criado.<br>   end if<br><br>   if (PLOT) then<br>       wksType = &quot;pdf&quot;                        ; extensão da figura. eps, pdf, ps, png<br>       wksName = &quot;mjoclivar&quot;                  ; &quot;mjo.&quot;+yrStrt+&quot;_&quot;+yrLast. Nome da figura a ser gerada.<br>   end if<br><br>;*****************************<wbr>******************************<br>; Read user specified time and create required yyyyddd                    <br>;*****************************<wbr>******************************<br>   f       = addfile (diri+fili , &quot;r&quot;)                          <br><br>   time    = f-&gt;time                       <wbr>   ; all times on file<br>   ymd     = cd_calendar(time, -2)            ; yyyymmdd<br>   iStrt   = ind(ymd.eq.ymdStrt)           <wbr>   ; index start<br>   iLast   = ind(ymd.eq.ymdLast)           <wbr>   ; index last <br>   delete(time)<br>   delete(ymd)<br><br>;*****************************<wbr>******************************<br>; Read user specified time and create required yyyyddd                    <br>;*****************************<wbr>******************************<br>   time    = f-&gt;time(iStrt:iLast)          <wbr>   ; time:units = &quot;hours since&quot;<br>   TIME    = cd_calendar(time, 0)             ; type float <br>   year    = floattointeger( TIME(:,0) )<br>   month   = floattointeger( TIME(:,1) )<br>   day     = floattointeger( TIME(:,2) ) <br>   ddd     = day_of_year(year, month, day) <br>   yyyyddd = year*1000 + ddd                  ; needed for input<br><br>;*****************************<wbr>******************************<br>; Read data: short2flt                     <wbr>                <br>;*****************************<wbr>****************************** <br>   x       =  short2flt( f-&gt;$var$(iStrt:iLast,:,:) )    ; convert to float <br>   printVarSummary( x ) <br><br>   <br>;*****************************<wbr>******************************<br>; Compute daily climatology: raw and then &#39;smoothed&#39;  <br>;*****************************<wbr>******************************<br>   xClmDay = clmDayTLL(x, yyyyddd)     ; daily climatology at each grid point<br>   printVarSummary(xClmDay)      <wbr>      <br><br>;*****************************<wbr>******************************<br>; Compute smoothed daily climatology using &#39;nhar&#39; harmonics<br>;*****************************<wbr>******************************<br>   xClmDay_sm = smthClmDayTLL(xClmDay, nhar)<br>   printVarSummary(xClmDay_sm)<br><br>;*****************************<wbr>******************************<br>; Compute daily anomalies using raw and smoothed climatologies<br>;*****************************<wbr>******************************<br>    xAnom      = calcDayAnomTLL (x, yyyyddd, xClmDay)     <br>    printVarSummary(xAnom)<br>    printMinMax(xAnom, True)<br><br>    xAnom_sm   = calcDayAnomTLL (x, yyyyddd, xClmDay_sm)     <br>    xAnom_sm@long_name = &quot;Anomalies from Smooth Daily Climatology&quot;<br>    printVarSummary(xAnom_sm)<br>    printMinMax(xAnom_sm, True)<br><br>    delete( x )    ; no longer needed<br><br><br>;*****************************<wbr>******************************<br>; Create netCDF: convenience use &#39;simple&#39; method<br>;*****************************<wbr>******************************<br><br>    dimx   = dimsizes(xAnom)<br>    ntim   = dimx(0)<br>    nlat   = dimx(1)<br>    mlon   = dimx(2)<br><br>    if (NC) then<br><br>        lat    = f-&gt;latitude<br>        lon    = f-&gt;longitude<br><br>        system(&quot;/bin/rm -f &quot;+diro+filo)      ; rm any pre-exist file, if any<br>        fnc    = addfile (diro+filo, &quot;c&quot;)<br><br>        filAtt = 0<br>        filAtt@title         = vName+&quot;: Daily Anomalies: &quot;+yrStrt+&quot;-&quot;+yrLast  <br>    filAtt@source_file   = fili<br>        filAtt@creation_date = systemfunc(&quot;date&quot;)<br>        fileattdef( fnc, filAtt )         ; copy file attributes  <br><br>        setfileoption(fnc,&quot;DefineMode&quot;<wbr>,True)<br>        <br>        varNC      = vName+&quot;_anom&quot;<br>        varNC_sm   = vName+&quot;_anom_sm&quot;<br><br>        dimNames = (/&quot;time&quot;, &quot;lat&quot;, &quot;lon&quot;/)  <br>    dimSizes = (/ -1   ,  nlat,  mlon/) <br>    dimUnlim = (/ True , False, False/)   <br>    filedimdef(fnc,dimNames,<wbr>dimSizes,dimUnlim)<br><br>        filevardef(fnc, &quot;time&quot;  ,typeof(time),getvardims(time)<wbr>) <br>        filevardef(fnc, &quot;lat&quot;   ,typeof(lat) ,getvardims(lat)) <br>        filevardef(fnc, &quot;lon&quot;   ,typeof(lon) ,getvardims(lon))<br>        filevardef(fnc, varNC   ,typeof(xAnom)   ,getvardims(xAnom))    <br>        filevardef(fnc, varNC_sm,typeof(xAnom)   ,getvardims(xAnom))    <br><br>        filevarattdef(fnc,&quot;time&quot;  ,time)                    ; copy time attributes<br>        filevarattdef(fnc,&quot;lat&quot;   ,lat)                     ; copy lat attributes<br>        filevarattdef(fnc,&quot;lon&quot;   ,lon)                     ; copy lon attributes<br>        filevarattdef(fnc,varNC   ,xAnom)                <br>        filevarattdef(fnc,varNC_sm,<wbr>xAnom_sm)                <br><br>        fnc-&gt;time       = (/time/)     <br>        fnc-&gt;lat        = (/lat/)<br>        fnc-&gt;lon        = (/lon/)<br>        fnc-&gt;$varNC$    = (/xAnom   /)<br>        fnc-&gt;$varNC_sm$ = (/xAnom_sm/)<br>    end if<br><br>;*****************************<wbr>*******************<br>; plotting parameters<br>;*****************************<wbr>*******************<br>    if (PLOT) then<br>        LAT   = (/ 60, 45,  5,  -5, -45, 60 /)<br>        LON   = (/270, 30, 90,  90, 180,  0 /)<br>        nPts  = dimsizes( LAT )<br><br>        plot  = new ( nPts, graphic)<br>        data  = new ( (/2,366/), typeof(xClmDay), getFillValue(xClmDay))<br><br>        wks   = gsn_open_wks (wksType,wksName)    <br><br>        res                   = True                      ; plot mods desired<br>        res@gsnDraw           = False<br>        res@gsnFrame          = False<br>        res@trXMinF           =   1<br>        res@trXMaxF           = 366<br>       ;res@tiMainString      = &quot;&quot;<br>       <br>        res@xyLineThicknesses = (/1.0, 2.0/)              ; make 2nd lines thicker<br>        res@xyLineColors      = (/&quot;blue&quot;,&quot;red&quot;/)          ; change line color<br>        res@xyMonoDashPattern = True                      ; all solid<br><br>        do np=0,nPts-1 <br>           data(0,:) = xClmDay(:,{LAT(np)},{LON(np)})<br>           data(1,:) = xClmDay_sm(:,{LAT(np)},{LON(<wbr>np)})<br>           res@gsnCenterString = &quot;lat=&quot;+LAT(np)+&quot;  lon=&quot;+LON(np)<br>           plot(np)  = gsn_csm_y (wks,data,res) ; create plot<br>        end do<br>       <br>        resP                     = True                ; modify the panel plot<br>        resP@txString            = vName+&quot;: Raw/Smooth Daily Climatology: &quot;+yrStrt+&quot;-&quot;+yrLast<br>        resP@gsnMaximize         = True<br>        resP@gsnPaperOrientation = &quot;portrait&quot;<br>        gsn_panel(wks,plot,(/(nPts/2),<wbr>2/),resP)               ; now draw as one plot<br><br>       ;==========<br>       ; Plot anomalies for an arbitrarily selected near equatorial location<br>       ; Time: Oct 1, 1996 to April 1,1997  [arbitrary selection]<br>       ;==========<br>        LATX    = 0<br>        LONX    = 90<br><br>        yyyymmdd  = cd_calendar(time, -2)<br>      ;;yrfrac    = yyyymmdd_to_yyyyfrac (yyyymmdd, 0)<br>      ;;delete(yrfrac@long_name)<br><br>        xAnom@long_name    = &quot;Anomalies from Raw&quot;   ; short labels for plot<br>        xAnom_sm@long_name = &quot;Anomalies from Smooth&quot;<br><br>        ntBegin   = ind(yyyymmdd.eq.20051001)<br>        ntEnd     = ind(yyyymmdd.eq.20060401)<br>       <br>        monthLabels    = (/1,4,7,10/)<br>        monNam = (/&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;<wbr>May&quot;,&quot;Jun&quot; \<br>                  ,&quot;Jul&quot;,&quot;Aug&quot;,&quot;Sep&quot;,&quot;Oct&quot;,&quot;Nov&quot;<wbr>,&quot;Dec&quot; /)<br>        xVal   = new(ntim, typeof(xAnom&amp;time) , &quot;No_FillValue&quot;) ; bigger than<br>        xLab   = new(ntim, &quot;string&quot;, &quot;No_FillValue&quot;)        ; needed<br>        xValm  = new(ntim, typeof(xAnom&amp;time) , &quot;No_FillValue&quot;) ; bigger than<br><br>        ntm            = -1<br>        cr             = inttochar(10)                 <wbr>    ; carriage return<br>        do nt=ntBegin,ntEnd<br>         if (day(nt).eq.1) then<br>             ntm       = ntm + 1<br>             xVal(ntm) = xAnom&amp;time(nt)<br>             xLab(ntm) = monNam(month(nt)-1)<br>             if (month(nt).eq.1) then<br>                 xLab(ntm) = xLab(ntm) + cr +sprinti(&quot;%0.4i&quot;, year(nt))<br>             end if<br>         end if<br>        end do<br><br>        rxy  = True      <br>        rxy@gsnDraw     = False<br>        rxy@gsnFrame    = False<br>        rxy@gsnYRefLine = 0.0                    ; create a reference line   <br>        rxy@gsnAboveYRefLineColor = &quot;red&quot;        ; above ref line fill red<br>        rxy@gsnBelowYRefLineColor = &quot;blue&quot;       ; below ref line fill blue<br>        rxy@xyLineThicknessF  = 2.0                           <wbr>                    <br>        rxy@vpHeightF  = 0.4                     ; resize            <br>        rxy@vpWidthF   = 0.8                  <br>        rxy@tmXBMode   = &quot;Explicit&quot;<br>        rxy@tmXBValues = xVal(0:ntm)<br>        rxy@tmXBLabels = xLab(0:ntm)<br><br>        plot(0)  = gsn_csm_xy (wks,time(ntBegin:ntEnd) \<br>                              ,xAnom(ntBegin:ntEnd,{0},{90})<wbr>,rxy) <br>        plot(1)  = gsn_csm_xy (wks,time(ntBegin:ntEnd) \<br>                              ,xAnom_sm(ntBegin:ntEnd,{0},{<wbr>90}),rxy) <br>        resP@txString  = vName+&quot;: Anomalies: (0,90E)&quot;<br>        gsn_panel(wks,plot(0:1),(/2,1/<wbr>),resP)   <br><br>    end if<br>end<br><div><br><br></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>