<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta name=Title content=""><meta name=Keywords content=""><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:Calibri;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:Calibri;
        color:windowtext;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:Calibri;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:595.0pt 842.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body bgcolor=white lang=EN-GB link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt'>Hi Karin,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>I have tried that and it did not work. I forgot to write that I tested that iteration as well.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>fatal:syntax error: line 15 in file process_t511.ncl before or near .128<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'> g = a->p100.128<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>----------------^<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>fatal:Syntax Error in block, block not executed<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>fatal:error at line 17 in file process_t511.ncl<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>I’m going to try using cdo to rename the variable to remove the “.” And test again.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>But the link should be updated to remove this example where the variable name contains a “.”.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>/M<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='color:black'>From: </span></b><span style='color:black'><ncl-talk-bounces@ucar.edu> on behalf of Karin Meier-Fleischer <meier-fleischer@dkrz.de><br><b>Date: </b>Wednesday, 30 November 2016 at 15:18<br><b>To: </b>Marston Johnston <marston.johnston@gu.se><br><b>Cc: </b>"ncl-talk [ncl-talk]" <ncl-talk@ucar.edu><br><b>Subject: </b>Re: [ncl-talk] error reading netcdf4 file</span><span style='color:black;mso-fareast-language:EN-GB'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Times New Roman"'><o:p> </o:p></span></p></div><p class=MsoNormal>Hi Marston,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>the variable name in your netCDF file is <span style='font-size:11.5pt;background:white'>p100.128 and not /p100.128. NCLs error message is exactly telling you what is wrong in line 18.</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;background:white'>Because the test script you send is not the script producing the error I guess that the line</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;background:white'> g = short2flt(a->/p100.128)</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;background:white'>is the problem. Change it to</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;background:white'> g = short2flt(a->p100.128)</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;background:white'>Bye,</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;background:white'>Karin</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p><div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>Am 30.11.2016 um 14:59 schrieb Marston Johnston <<a href="mailto:marston.johnston@gu.se">marston.johnston@gu.se</a>>:<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal><span style='font-size:11.0pt'>Hi,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>I writing a small script to read a netcdf4 file that was created by grib_api (version 1.17.0). But despite following the examples given here: <a href="http://www.ncl.ucar.edu/Applications/netcdf4.shtml">http://www.ncl.ucar.edu/Applications/netcdf4.shtml</a>. At first I thought the “.” in the variable name was causing the problem but in the examples given in the link above, such a file naming type was given. I’ve tried using $”/p100.128”$, treating it as a group: a=>/p100.128, but to no avail.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>I can upload the file for testing. </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>****************** script *********************</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>begin</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> idir="/home/ "</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> fil="ICMGGglxc+2007var100.nc"</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> setfileoption("nc", "FileStructure", "Advanced")</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> setfileoption("nc", "Format", "NetCDF4")</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> a = addfile(idir+fil,"r")</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> printVarSummary(a)</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> vNames = getfilevarnames (a)</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> print(vNames)</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> g = short2flt(a->/p100.128)</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> printVarInfo(g,"g")</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>end</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>***************** results ********************</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>[nclcodes]$ ncdump -k /home/ICMGGglxc+2007var100.nc</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>netCDF-4</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>[nclcodes]$</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>ncdump -g /p100.128 /home/ICMGGglxc+2007var100.nc</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>ncdump: /p100.128: No such group</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>[nclcodes]$ ncdump -h /home/ICMGGglxc+2007var100.nc</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>netcdf ICMGGglxc+2007var100 {</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>dimensions:</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> longitude = 1024 ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> latitude = 512 ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> level = 11 ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> time = UNLIMITED ; // (2920 currently)</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>variables:</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> float longitude(longitude) ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> longitude:standard_name = "longitude" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> longitude:long_name = "longitude" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> longitude:units = "degrees_east" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> longitude:axis = "X" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> float latitude(latitude) ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> latitude:standard_name = "latitude" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> latitude:long_name = "latitude" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> latitude:units = "degrees_north" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> latitude:axis = "Y" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> double level(level) ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> level:long_name = "model_level_number" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> level:axis = "Z" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> double time(time) ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> time:standard_name = "time" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> time:long_name = "time" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> time:units = "hours since 1900-1-1 00:00:00" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> time:calendar = "standard" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> time:axis = "T" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> short p100.128(time, level, latitude, longitude) ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> p100.128:long_name = "Experimental product" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> p100.128:units = "~" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> p100.128:grid_type = "gaussian" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> p100.128:add_offset = 2826.8713701289 ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> p100.128:scale_factor = 0.0914882578243023 ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> p100.128:_FillValue = -32767s ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> p100.128:missing_value = -32767s ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>// global attributes:</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> :CDI = "Climate Data Interface version 1.7.0 (<a href="http://mpimet.mpg.de/cdi">http://mpimet.mpg.de/cdi</a>)" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> :history = "Mon Nov 28 23:20:13 2016: cdo -O -v mergetime ICMGGglxc+200701_var100.nc ICMGGglxc+200702_var100.nc ICMGGglxc+200703_var100.nc ICMGGglxc+200704_var100.nc ICMGGglxc+200705_var100.nc ICMGGglxc+200706_var100.nc ICMGGglxc+200707_var100.nc ICMGGglxc+200708_var100.nc ICMGGglxc+200709_var100.nc ICMGGglxc+200710_var100.nc ICMGGglxc+200711_var100.nc ICMGGglxc+200712_var100.nc ICMGGglxc+2007var100.nc\n2016-11-28 22:01:41 GMT by grib_to_netcdf-1.17.0: grib_to_netcdf -k 3 -o ICMGGglxc+200712_var100.nc ICMGGglxc+200712_var100.grb" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> :Conventions = "CF-1.6" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> :CDO = "Climate Data Operators version 1.7.0 (<a href="http://mpimet.mpg.de/cdo">http://mpimet.mpg.de/cdo</a>)" ;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>}</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>[nclcodes]$</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>[nclcodes]$ ncl process_t511.ncl</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Copyright (C) 1995-2015 - All Rights Reserved</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>University Corporation for Atmospheric Research</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>NCAR Command Language Version 6.3.0</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>The use of this software is governed by a License Agreement.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>See <a href="http://www.ncl.ucar.edu/">http://www.ncl.ucar.edu/</a> for more details.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Variable: a</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Type: file</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>File path : /home/ICMGGglxc+2007var100.nc</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Number of global attributes : 4</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Number of dimensions : 4</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Number of chunk_dimensions : 1</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Number of variables : 5</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Variable: vNames</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Type: string</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Total Size: 40 bytes</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> 5 values</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Number of Dimensions: 1</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Dimensions and sizes: [5]</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Coordinates:</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>(0) /longitude</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>(1) /latitude</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>(2) /level</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>(3) /time</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>(4) /p100.128</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>fatal:["Execute.c":132]:variable (/p100.128) is not in file (/home/ICMGGglxc+2007var100.nc)</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>fatal:["Execute.c":6316]:variable (/p100.128) is not in file (a)</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 18 in file process_t511.ncl</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>Cheers,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt'>/M</span><o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p></div><p class=MsoNormal><span style='font-family:"Times New Roman";mso-fareast-language:EN-GB'>_______________________________________________<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>http://mailman.ucar.edu/mailman/listinfo/ncl-talk<o:p></o:p></span></p></div></blockquote></div><p class=MsoNormal><span style='font-family:"Times New Roman";mso-fareast-language:EN-GB'><o:p> </o:p></span></p><div><div><div><div><div><div><div><div><div><p class=MsoNormal><span style='font-family:Helvetica;color:black;mso-fareast-language:EN-GB'><o:p> </o:p></span></p></div></div></div></div></div></div></div></div></div></div><p class=MsoNormal><span style='font-family:"Times New Roman";mso-fareast-language:EN-GB'>_______________________________________________ ncl-talk mailing list ncl-talk@ucar.edu List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talk <o:p></o:p></span></p></div></body></html>