Re: Slow write when adding array Attributes

James Garnett wrote:

I have recently added some new Attributes that are integer arrays.  About
10 attributes, and the array size can be anywhere from a few, to a few
hundred.

It seems we now take much much longer to write our files.

Originally, I isolated a 10 second delay in the call to nc_close.  After
looking at the code, I realized that I was returning to define mode to add
these arrays after having added the data, and speculated that nc_close had
to reorder memory so that all the attributes were written before the data.
I fixed my code to do the data last, and now the call to nc_close is quick,
but the call to nc_enddef is very slow (again about 10 seconds).  In the
sample file that I used for testing, I have a single variable, and the
array size is around 200.  I'm running under Windows with NetCDF 3.x.

Is there any explanation why this takes so long, or any ideas on how to
optimize my code to make it faster?

Thanks,
Jim
"much longer" usually means you are inadvertantly rewriting the file, by making the header longer by adding new attributes or variables,
its best if  you do all your "define mode" work before you wite any data.


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