<div dir="ltr">Kyle&#39;s right about reading error messages, specifically this one: <div><b><span style="font-size:13px">fatal:Undefined identifier: (cv_inv_calendar) is undefined, can&#39;t continue</span><br style="font-size:13px"><span style="font-size:13px">fatal:[&quot;Execute.c&quot;:8578]:</span><u style="font-size:13px"></u><span style="font-size:13px">Execu</span><span style="font-size:13px">te: Error occurred at or near line 103 in file IR_download_and_crop.ncl</span></b><br style="font-size:13px"><br style="font-size:13px"></div><div>It&#39;s <b>cd</b>_inv_calendar()</div><div><br></div><div><br></div><div>However there is still a problem.   The below works on 6.0 and 6.2.0 but I get the same error as you in 6.2.1  on the lines using ut_inv_calendar.  </div><div><br></div><div>This seems to be a backward compatible issue with the deprecated function and using cd_inv_calendar should solve the problem. </div><div><br></div><div><br></div><div>Alan. </div><div><br></div><div><br></div><div><br></div><div><div><br></div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;</div><div><br></div><div>begin                                      </div><div>;# Set intital string variables</div><div>time_array=new((/240/),&quot;double&quot;)</div><div>time_array@units = &quot;hours ref 1-1-1 00:00:0.0&quot;</div><div>;######## Begin the time loop ########</div><div>beg=15</div><div>day_ind = 0</div><div>hr_ind = 0</div><div>;########## SET THE TIMES ######## </div><div><br></div><div><div>   time_array(48*day_ind+hr_ind*2) = cd_inv_calendar(2006,7,beg+day_ind+1,hr_ind+1,0,0,time_array@units, 0)</div><div>   time_array(48*day_ind+hr_ind*2+1) = cd_inv_calendar(2006,7,beg+day_ind+1,hr_ind+1,30,0,time_array@units, 0)</div><div><br></div><div>print(    time_array(48*day_ind+hr_ind*2)  )</div><div>print(   time_array(48*day_ind+hr_ind*2+1) ) </div></div><div><br></div><div><br></div><div>   time_array(48*day_ind+hr_ind*2) = ut_inv_calendar(2006,7,beg+day_ind+1,hr_ind+1,0,0,time_array@units, 0)</div><div>   time_array(48*day_ind+hr_ind*2+1) = ut_inv_calendar(2006,7,beg+day_ind+1,hr_ind+1,30,0,time_array@units, 0)</div><div><br></div><div>print(    time_array(48*day_ind+hr_ind*2)  )</div><div>print(   time_array(48*day_ind+hr_ind*2+1) ) </div><div><br></div><div>end</div><br style="font-size:13px"><br style="font-size:13px"></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 27, 2015 at 8:19 AM, Kyle Griffin <span dir="ltr">&lt;<a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Conrado,</p>
<p dir="ltr">Please read your error messages more carefully! They tell you exactly what is going wrong. In this case, it tells me that you did not spell the &quot;cd&quot; part of the function name correctly...fix that so the name is as Dennis suggested and let us know how that goes.<br></p>
<p dir="ltr">Kyle</p>
<div class="gmail_quote"><div><div class="h5">On Feb 27, 2015 6:58 AM,  &lt;<a href="mailto:jorge.conrado@cptec.inpe.br" target="_blank">jorge.conrado@cptec.inpe.br</a>&gt; wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><br>
<br>
<br>
      Hi,<br>
<br>
      I don&#39;t have experience with the NCL and I downloaded a script (IR_download_and_crop.ncl) in the Web to download images from the ftp address:<br>
<br>
<br>
      <a href="ftp://disc2.nascom.nasa.gov/data/s4pa/TRMM_ANCILLARY/MERG/" target="_blank">ftp://disc2.nascom.nasa.gov/<u></u>data/s4pa/TRMM_ANCILLARY/MERG/</a><br>
<br>
<br>
      This the script:<br>
<br>
<br>
<br>
<br>
;########## IR_download_and_crop.ncl #############<br>
;# This program downloads data from the NASA Merged IR database and crops to<br>
;# the specified region and time period. A NETCDF file of the data is made<br>
;# and the orignial fortran binary data is deleted.<br>
<br>
;# 1. Set inital variables<br>
;# 2. Read in 5 days of data over W. Africa write to NETCDF at 4km, 30 min<br>
<br>
load &quot;$NCARG_ROOT/lib/ncarg/<u></u>nclscripts/csm/gsn_code.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/<u></u>nclscripts/csm/gsn_csm.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/<u></u>nclscripts/csm/skewt_func.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/<u></u>nclscripts/csm/contributed.<u></u>ncl&quot;<br>
<br>
begin<br>
<br>
;######## SET INITIAL VARS ########<br>
<br>
;# Reference information for the Merged IR Dataset<br>
;# For 2006...<br>
;# Jul begins on day 182 and ends on 212<br>
;# Aug begins on day 213 and ends on 243<br>
;# Sep begins on day 244 and ends on 273<br>
<br>
;# Set intital string variables<br>
hr=(/&quot;00&quot;,&quot;01&quot;,&quot;02&quot;,&quot;03&quot;,&quot;04&quot;,<u></u>&quot;05&quot;,&quot;06&quot;,&quot;07&quot;,&quot;08&quot;,&quot;09&quot;,&quot;10&quot;,<u></u>&quot;11&quot;,&quot;12&quot;,&quot;13&quot;,&quot;14&quot;,&quot;15&quot;,&quot;16&quot;,<u></u>&quot;17&quot;,&quot;18&quot;,&quot;19&quot;,&quot;20&quot;,&quot;21&quot;,&quot;22&quot;,<u></u>&quot;23&quot;/)<br>
<br>
day_31=(/&quot;01&quot;,&quot;02&quot;,&quot;03&quot;,&quot;04&quot;,&quot;<u></u>05&quot;,&quot;06&quot;,&quot;07&quot;,&quot;08&quot;,&quot;09&quot;,&quot;10&quot;,&quot;<u></u>11&quot;,&quot;12&quot;,&quot;13&quot;,&quot;14&quot;,&quot;15&quot;,&quot;16&quot;,&quot;<u></u>17&quot;,&quot;18&quot;,&quot;19&quot;,&quot;20&quot;,&quot;21&quot;,&quot;22&quot;,&quot;<u></u>23&quot;,&quot;24&quot;,&quot;25&quot;,&quot;26&quot;,&quot;27&quot;,&quot;28&quot;,&quot;<u></u>29&quot;,&quot;30&quot;,&quot;31&quot;/)<br>
<br>
day_30=(/&quot;01&quot;,&quot;02&quot;,&quot;03&quot;,&quot;04&quot;,&quot;<u></u>05&quot;,&quot;06&quot;,&quot;07&quot;,&quot;08&quot;,&quot;09&quot;,&quot;10&quot;,&quot;<u></u>11&quot;,&quot;12&quot;,&quot;13&quot;,&quot;14&quot;,&quot;15&quot;,&quot;16&quot;,&quot;<u></u>17&quot;,&quot;18&quot;,&quot;19&quot;,&quot;20&quot;,&quot;21&quot;,&quot;22&quot;,&quot;<u></u>23&quot;,&quot;24&quot;,&quot;25&quot;,&quot;26&quot;,&quot;27&quot;,&quot;28&quot;,&quot;<u></u>29&quot;,&quot;30&quot;/)<br>
<br>
time_array=new((/240/),&quot;<u></u>double&quot;)<br>
<br>
time_array@units = &quot;hours ref 1-1-1 00:00:0.0&quot;<br>
<br>
;# For the July brightness temp. array a byte array is storred to reduce memory requirements and storage space.<br>
;# Convert to another data type and add 75.<br>
<br>
tb_array=new((/240,825,1925/),<u></u>&quot;float&quot;)<br>
<br>
;######## Begin the time loop ########<br>
<br>
beg=15<br>
<br>
do day_ind=0,4<br>
   do hr_ind=0,23<br>
<br>
   file_name_download = &quot;<a href="ftp://disc2.nascom.nasa.gov/data/s4pa/TRMM_ANCILLARY/MERG/2006/" target="_blank">ftp://disc2.nascom.nasa.gov/<u></u>data/s4pa/TRMM_ANCILLARY/MERG/<u></u>2006/</a>&quot;+(beg+day_ind+182)+&quot;/<u></u>merg_200607&quot;+day_31(beg+day_<u></u>ind)+hr(hr_ind)+&quot;_4km-pixel.Z&quot;<br>
   system(&quot;wget &quot;+file_name_download)<br>
<br>
;####### READ THE FORTRAN BINARY ##############<br>
<br>
   file_name_read_zip = &quot;merg_200607&quot;+day_31(beg+day_<u></u>ind)+hr(hr_ind)+&quot;_4km-pixel.Z&quot;<br>
   file_name_read = &quot;merg_200607&quot;+day_31(beg+day_<u></u>ind)+hr(hr_ind)+&quot;_4km-pixel&quot;<br>
<br>
   print(file_name_read)<br>
<br>
   system(&quot;gunzip &quot;+file_name_read_zip)<br>
<br>
   ;# Set Fortran read options<br>
<br>
   setfileoption(&quot;bin&quot;,&quot;<u></u>ReadByteOrder&quot;,&quot;LittleEndian&quot;)<br>
   ir_temp   = byte2flt(fbindirread (file_name_read ,0, (/2,3298,9896/),&quot;byte&quot;))+75.<br>
<br>
   system(&quot;rm -f &quot;+file_name_read)<br>
<br>
;######## CROP THE IR GRID FOR WEST AFR #######<br>
;# LARGE: 319.998E(8795)-59.97576E(1648)<u></u>,40.0013N(549)-19.9772S(2197)<br>
;# LIMIT: 334.9874E(9207)-44.98637E(<u></u>1236),25.00667N(961)-4.<u></u>982578S(1785)<br>
<br>
   lon=fspan(0.0182,0.0182+0.<u></u>036378335*9896,9896)<br>
   lat=fspan(59.982,59.982-0.<u></u>036383683*3298,3298)<br>
<br>
   lon@units      = &quot;degrees-east&quot;<br>
   lat@units      = &quot;degrees-north&quot;<br>
<br>
   ir_temp!2    = &quot;lon&quot;<br>
   ir_temp!1    = &quot;lat&quot;<br>
   ir_temp!0    = &quot;time&quot;<br>
<br>
   ir_temp_re_0=new((/825,1925/),<u></u>&quot;float&quot;)<br>
   ir_temp_re_1=new((/825,1925/),<u></u>&quot;float&quot;)<br>
<br>
   ir_temp_re_0(:,:687)=ir_temp(<u></u>lat|961:1785,lon|9207:9894,<u></u>time|0)<br>
   ir_temp_re_0(:,688:)=ir_temp(<u></u>lat|961:1785,lon|:1236,time|0)<br>
<br>
   ir_temp_re_1(:,:687)=ir_temp(<u></u>lat|961:1785,lon|9207:9894,<u></u>time|1)<br>
   ir_temp_re_1(:,688:)=ir_temp(<u></u>lat|961:1785,lon|:1236,time|1)<br>
<br>
   lon_out = new((/1925/),&quot;float&quot;)<br>
<br>
   lon_out(:687)=lon(9207:9894)<br>
   lon_out(688:)=lon(0:1236)<br>
<br>
   lat_out  = lat(961:1785)<br>
<br>
;########## PLACE IN ARRAY #######<br>
<br>
   tb_array(48*day_ind+hr_ind*2,:<u></u>,:)=ir_temp_re_0       ;# First half hour<br>
   tb_array(48*day_ind+hr_ind*2+<u></u>1,:,:)=ir_temp_re_1     ;# Second half hour<br>
<br>
;########## SET THE TIMES ########<br>
<br>
   time_array(48*day_ind+hr_ind*<u></u>2) = ut_inv_calendar(2006,7,beg+<u></u>day_ind+1,hr_ind+1,0,0,time_<u></u>array@units, 0)<br>
   time_array(48*day_ind+hr_ind*<u></u>2+1) = ut_inv_calendar(2006,7,beg+<u></u>day_ind+1,hr_ind+1,30,0,time_<u></u>array@units, 0)<br>
<br>
   end do<br>
end do<br>
<br>
;######## CREATE THE NETCDF FILE ########<br>
<br>
   ntim  = 240<br>
   nlat  = 825<br>
   nlon  = 1925<br>
<br>
   diro = &quot;./&quot;                     ; Output directory<br>
   filo = &quot;<a href="http://ir_test_jul_16_to_jul_20.nc" target="_blank">ir_test_jul_16_to_jul_20.nc</a>&quot;             ; Output file<br>
   system(&quot;/bin/rm -f &quot; + diro + filo)    ; remove if exists<br>
   fout  = addfile (diro + filo, &quot;c&quot;)  ; open output file<br>
<br>
;=============================<u></u>==============================<u></u>========<br>
; explicitly declare file definition mode. Improve efficiency.<br>
;=============================<u></u>==============================<u></u>========<br>
<br>
   setfileoption(fout,&quot;<u></u>DefineMode&quot;,True)<br>
<br>
;=============================<u></u>==============================<u></u>========<br>
; create global attributes of the file<br>
;=============================<u></u>==============================<u></u>========<br>
<br>
   fAtt               = True            ; assign file attributes<br>
   fAtt@title         = &quot;NCL Efficient Approach to netCDF Creation&quot;<br>
   fAtt@source_file   =  &quot;<a href="http://original-file.nc" target="_blank">original-file.nc</a>&quot;<br>
   fAtt@Conventions   = &quot;None&quot;<br>
   fAtt@creation_date = systemfunc (&quot;date&quot;)<br>
   fileattdef( fout, fAtt )            ; copy file attributes<br>
<br>
;=============================<u></u>==============================<u></u>========<br>
; predefine the coordinate variables and their dimensionality<br>
; Note: to get an UNLIMITED record dimension, we set the dimensionality<br>
; to -1 (or the actual size) and set the dimension name to True.<br>
;=============================<u></u>==============================<u></u>========<br>
<br>
   dimNames = (/&quot;time&quot;, &quot;lat&quot;, &quot;lon&quot;/)<br>
   dimSizes = (/ -1   ,  nlat,  nlon/)<br>
   dimUnlim = (/ True , False, False/)<br>
   filedimdef(fout,dimNames,<u></u>dimSizes,dimUnlim)<br>
<br>
;=============================<u></u>==============================<u></u>========<br>
; predefine the the dimensionality of the variables to be written out<br>
;=============================<u></u>==============================<u></u>========<br>
; Here we are using NCL functions to facilitate defining<br>
; each variable&#39;s dimension name(s) and type.<br>
; The following could be replaced with explicit, user defined dimension<br>
; names different from those associated with the variable in memory.<br>
; Say, PS(time,lat,lon) in the NCL script. They could be redefined for the file via:<br>
; filevardef(fout, &quot;PS&quot;   ,typeof(PS) ,(/&quot;TIME&quot;,&quot;latitude&quot;,&quot;<u></u>longitude&quot;/))<br>
;=============================<u></u>==============================<u></u>========<br>
<br>
   filevardef(fout, &quot;time&quot; ,(/&quot;double&quot;/),(/&quot;time&quot;/))<br>
   filevardef(fout, &quot;lat&quot;  ,(/&quot;float&quot;/),(/&quot;lat&quot;/))<br>
   filevardef(fout, &quot;lon&quot;  ,(/&quot;float&quot;/),(/&quot;lon&quot;/))<br>
   filevardef(fout, &quot;TB&quot;   ,(/&quot;float&quot;/),(/&quot;time&quot;,&quot;lat&quot;,&quot;<u></u>lon&quot;/))<br>
<br>
;=============================<u></u>==============================<u></u>========<br>
; Copy attributes associated with each variable to the file<br>
; All attributes associated with each variable will be copied.<br>
;=============================<u></u>==============================<u></u>=========<br>
<br>
   filevarattdef(fout,&quot;time&quot; ,time_array)              ; copy time attributes<br>
   filevarattdef(fout,&quot;lat&quot;  ,lat_out)                 ; copy lat attributes<br>
   filevarattdef(fout,&quot;lon&quot;  ,lon_out)                 ; copy lon attributes<br>
   filevarattdef(fout,&quot;TB&quot;   ,tb_array)                      ; copy PS attributes<br>
<br>
;=============================<u></u>==============================<u></u>========<br>
; explicitly exit file definition mode. **NOT REQUIRED**<br>
;=============================<u></u>==============================<u></u>========<br>
<br>
   setfileoption(fout,&quot;<u></u>DefineMode&quot;,False)<br>
<br>
;=============================<u></u>==============================<u></u>========<br>
; output only the data values since the dimensionality and such have<br>
; been predefined. The &quot;(/&quot;, &quot;/)&quot; syntax tells NCL to only output the<br>
; data values to the predefined locations on the file.<br>
;=============================<u></u>==============================<u></u>=========<br>
<br>
   fout-&gt;time   = (/time_array/)<br>
   fout-&gt;lat    = (/lat_out/)<br>
   fout-&gt;lon    = (/lon_out/)<br>
   fout-&gt;TB      = (/tb_array/)<br>
<br>
end<br>
<br>
<br>
<br>
     I run it and the script download the images, but this the line<br>
<br>
<br>
  time_array(48*day_ind+hr_ind*<u></u>2) = ut_inv_calendar(2006,7,beg+<u></u>day_ind+1,hr_ind+1,0,0,time_<u></u>array@units, 0)<br>
   time_array(48*day_ind+hr_ind*<u></u>2+1) =<br>
<br>
<br>
    I had the message:<br>
<br>
<br>
fatal:ut_inv_calendar: Invalid specification string<br>
fatal:[&quot;Execute.c&quot;:8578]:<u></u>Execute: Error occurred at or near line 103 in file IR_download_and_crop.ncl<br>
<br>
<br>
<br>
     I already change the ut_inv_calendar to cd_inv_calendar but I had the same error.<br>
<br>
<br>
fatal:Undefined identifier: (cv_inv_calendar) is undefined, can&#39;t continue<br>
fatal:[&quot;Execute.c&quot;:8578]:<u></u>Execute: Error occurred at or near line 103 in file IR_download_and_crop.ncl<br>
<br>
<br>
<br>
<br>
fatal:ut_inv_calendar: Invalid specification string<br>
fatal:[&quot;Execute.c&quot;:8578]:<u></u>Execute: Error occurred at or near line 103 in file IR_download_and_crop.ncl<br>
<br>
<br>
    I don&#39;t know how can I solve this error.<br>
<br>
<br>
    Thank  for all that help me with the question I asked yesterday.<br>
<br>
<br>
    Conrado<br>
<br>
<br>
<br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>