<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 http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<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-compose;
        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-family:Calibri;
        mso-fareast-language:EN-US;}
@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,<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 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.<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 can upload the file for testing.
<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">****************** script *********************<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">begin<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> idir="/home/ "<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> fil="ICMGGglxc+2007var100.nc"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> setfileoption("nc", "FileStructure", "Advanced")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> setfileoption("nc", "Format", "NetCDF4")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> a = addfile(idir+fil,"r")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> printVarSummary(a)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> vNames = getfilevarnames (a)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> print(vNames)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> g = short2flt(a->/p100.128)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> printVarInfo(g,"g")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">end<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">***************** results ********************<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">[nclcodes]$ ncdump -k /home/ICMGGglxc+2007var100.nc<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">netCDF-4<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">[nclcodes]$<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">ncdump -g /p100.128 /home/ICMGGglxc+2007var100.nc<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">ncdump: /p100.128: No such group<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">[nclcodes]$ ncdump -h /home/ICMGGglxc+2007var100.nc<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">netcdf ICMGGglxc+2007var100 {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">dimensions:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> longitude = 1024 ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> latitude = 512 ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> level = 11 ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> time = UNLIMITED ; // (2920 currently)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">variables:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> float longitude(longitude) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> longitude:standard_name = "longitude" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> longitude:long_name = "longitude" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> longitude:units = "degrees_east" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> longitude:axis = "X" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> float latitude(latitude) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> latitude:standard_name = "latitude" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> latitude:long_name = "latitude" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> latitude:units = "degrees_north" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> latitude:axis = "Y" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> double level(level) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> level:long_name = "model_level_number" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> level:axis = "Z" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> double time(time) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> time:standard_name = "time" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> time:long_name = "time" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> time:units = "hours since 1900-1-1 00:00:00" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> time:calendar = "standard" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> time:axis = "T" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> short p100.128(time, level, latitude, longitude) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> p100.128:long_name = "Experimental product" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> p100.128:units = "~" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> p100.128:grid_type = "gaussian" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> p100.128:add_offset = 2826.8713701289 ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> p100.128:scale_factor = 0.0914882578243023 ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> p100.128:_FillValue = -32767s ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> p100.128:missing_value = -32767s ;<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">// global attributes:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> :CDI = "Climate Data Interface version 1.7.0 (http://mpimet.mpg.de/cdi)" ;<o:p></o:p></span></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" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> :Conventions = "CF-1.6" ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> :CDO = "Climate Data Operators version 1.7.0 (http://mpimet.mpg.de/cdo)" ;<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">[nclcodes]$<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">[nclcodes]$ ncl process_t511.ncl<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Copyright (C) 1995-2015 - All Rights Reserved<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">University Corporation for Atmospheric Research<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">NCAR Command Language Version 6.3.0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">The use of this software is governed by a License Agreement.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">See http://www.ncl.ucar.edu/ for more details.<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">Variable: a<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Type: file<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">File path : /home/ICMGGglxc+2007var100.nc<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">Number of global attributes : 4<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Number of dimensions : 4<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Number of chunk_dimensions : 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Number of variables : 5<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">Variable: vNames<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Type: string<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Total Size: 40 bytes<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> 5 values<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Number of Dimensions: 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Dimensions and sizes: [5]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Coordinates:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">(0) /longitude<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">(1) /latitude<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">(2) /level<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">(3) /time<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">(4) /p100.128<o:p></o:p></span></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)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">fatal:["Execute.c":6316]:variable (/p100.128) is not in file (a)<o:p></o:p></span></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<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">Cheers,<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"><o:p> </o:p></p>
</div>
</body>
</html>