[netcdfgroup] Ordering of creating dimensions/variables/metadata etc...

Hi,

I am creating netCDF4-classic files from scratch using the netcdf4-python library. I'm frequently hitting an assertion failure:

nc4hdf.c:90: rec_detach_scales: Assertion `grp && grp->name && dimid >= 0 && dimscaleid >= 0' failed.

Looking at the source code for netcdf 4.0.1, the comments for the function rec_detach_scales seem to suggest that this function should only be called in rare cases. This leads me to believe I'm doing things in a bad order:

1. Define all global attributes (CF conventions, author etc..)
2. Define all dimensions (time/lat/lon)
3. Define the dimension variables corresponding to time/lat/lon (eg writing all the metadata for each dimension)
4. Define a particular variable (flags) for data to be stored in
5. Define another metadata variable (for the map projection)
6. Define a whole set of variables to store data in
7. Insert the data for latitude/longitude
8. Insert the data for the flags variable
9. Insert the time data
10. Insert the data for each of the variables from (6)

So I have 2 questions:
1. Is the assertion failure a bug, or because of something I'm doing wrong?
2. What is the best order for setting up the file? Eg should the coordinate data be inserted immediately after defining the coordinate variables and dimensions?

Many thanks,

Andrew Clegg

--------------------------------------------------------------------------------
Plymouth Marine Laboratory

Registered Office:
Prospect Place The Hoe
Plymouth  PL1 3DH

Website: www.pml.ac.uk
Registered Charity No. 1091222
PML is a company limited by guarantee
registered in England & Wales
company number 4178503

PML is a member of the Plymouth Marine Sciences Partnership
Website: www.pmsp.org.uk --------------------------------------------------------------------------------
This e-mail, its content and any file attachments are confidential.

If you have received this e-mail in error please do not copy, disclose it to 
any third party or use the contents or attachments in any way. Please notify 
the sender by replying to this e-mail or e-mail forinfo@xxxxxxxxx and then 
delete the email without making any copies or using it in any other way.

The content of this message may contain personal views which are not the views 
of Plymouth Marine Laboratory unless specifically stated.

You are reminded that e-mail communications are not secure and may contain 
viruses. Plymouth Marine Laboratory accepts no liability for any loss or damage 
which may be caused by viruses.
--------------------------------------------------------------------------------



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