Re: [netcdfgroup] Creating NetCDF dataset from 2D array by progressive writing of array columns

  • To: Sjur Kolberg <Sjur.A.Kolberg@xxxxxxxxx>
  • Subject: Re: [netcdfgroup] Creating NetCDF dataset from 2D array by progressive writing of array columns
  • From: Nicholas Kinar <n.kinar@xxxxxxxx>
  • Date: Thu, 13 May 2010 15:05:20 -0600

Hi Nicholas,

Instead of this:
          // Write each column to file?
          for(int i = 0; i<   NY; i++)
              data->put( dataOut, i, NX );
try the following:

for (int i=0; i<NY; i++)  // iterate over rows
{
   data->set_cur(i*NX);    // set data's current_pointer to start of i'th row
   data->put(dataOut,1,NX);// copy 1*NX numbers from dataOut to data; row (Y) 
major
}

I haven't digested the rest of your code, but certainly the arguments to put() 
are lengths, not indexes.

Good luck,

Sjur K :-)

Hello Sjur---

Many thanks for your response; it is greatly appreciated. I will have to experiment with my code. Once again, thank you!

Nicholas



  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: