<div dir="ltr"><div class="gmail_default" style="font-family:comic sans ms,sans-serif;color:#38761d">The netcdf-3 classic file is incorrect and probably corrupt - 16GB exceeds the variable size constraints of that format. You can use CDF5 as output by pnetcdf to write the file and then read it again with pnetcdf but netcdf doesn't support the CDF5 standard until version 4.4. </div><div class="gmail_default" style="font-family:comic sans ms,sans-serif;color:#38761d"><br></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif;color:#38761d"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 9, 2015 at 7:47 PM, Felicity Graham <span dir="ltr"><<a href="mailto:f.s.graham@utas.edu.au" target="_blank">f.s.graham@utas.edu.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
Hello, </div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<br>
</div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
I’d like to use parallel netcdf in C to read the only variable from a 16GB netcdf file and perform some operations. </div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<br>
</div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
The file format is classic, and was created with netcdf 3.6.3. I’m using openmpi 1.6.3 and pnetcdf 1.4.1.</div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<br>
</div>
<div style="color:rgb(0,0,0)"><font face="Calibri,sans-serif" style="font-size:14px">I’ve tested on a separate netcdf-4 formatted file, and the reading works fine, but on the classic file, I get the error </font><span style="font-size:11px;font-family:Menlo">NetCDF:
One or more variable sizes violate format constraints </span>when I try to open the file (ncmpi_open).</div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<br>
</div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<font face="Calibri,sans-serif">A stripped down version of the C code is b</font>elow.</div>
<div style="color:rgb(0,0,0)"><br>
</div>
<div style="color:rgb(0,0,0)">
<div style="font-size:14px;font-family:Calibri,sans-serif">Your help is much appreciated.</div>
<div style="font-size:14px;font-family:Calibri,sans-serif"><br>
</div>
<div style="font-size:14px;font-family:Calibri,sans-serif">Cheers,</div>
<div style="font-size:14px;font-family:Calibri,sans-serif">Felicity</div>
<div style="font-size:14px;font-family:Calibri,sans-serif"><br>
</div>
<div style="font-size:14px;font-family:Calibri,sans-serif">
<div></div>
</div>
</div>
<div style="font-size:14px;font-family:Calibri,sans-serif"><br>
</div>
<div style="font-size:14px;font-family:Calibri,sans-serif">
<p style="margin:0px;font-size:11px;font-family:Menlo">#include <stdio.h></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">#include <mpi.h></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">#include <pnetcdf.h></p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br>
</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">#define FILE_NAME “<path_to_file>/<a href="http://hf_topog.nc" target="_blank">hf_topog.nc</a>"</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">#define VAR_NAME "hf_topog"</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br>
</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">#define CHECK_ERR {\</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> if (err!=NC_NOERR) {\</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));\</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> goto fn_exit;\</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> }}</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br>
</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">int main(int argc, char **argv)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">{</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> int err, varid, ncid;</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> float * topog_in;</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br>
</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> MPI_Init(&argc,&argv);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br>
</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> err = ncmpi_open(MPI_COMM_WORLD, FILE_NAME, NC_NOWRITE, MPI_INFO_NULL, &ncid);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> CHECK_ERR;</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br>
</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> err = ncmpi_close(ncid);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> CHECK_ERR;</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br>
</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">fn_exit:</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> MPI_Finalize();</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br>
</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> return 0;</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">}</p>
</div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<br>
</div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div></div>
</div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<br>
</div>
<p><br>
<br>
University of Tasmania Electronic Communications Policy (December, 2014). <br>
This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained
in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
</p>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div><div>Jim Edwards<br><br></div><font size="1">CESM Software Engineer<br></font></div><font size="1">National Center for Atmospheric Research<br></font></div><font size="1">Boulder, CO</font> <br></div></div>
</div>