Appending a Netcdf file in C++

Hi Russ and the community

I am trying to append a Netcdf file ,that it is already exist ,with a new
variable and new data:
After appending, when i am looking to the file, it didn't
append it but it has overwritten data ?
I have the same size between the file before and after appending

this is my code:

  NcFile* lp_fichier;
  lp_fichier = new NcFile( aiv_file, NcFile::Write);
  NcDim* lp_dim[2];
  lp_dim[0] = lp_fichier->get_dim("mbCycleNbr") ;
  lp_dim[1] = lp_fichier->get_dim("mbBeamNbr") ;

  NcVar* lp_var = lp_fichier->add_var((NcToken )"mbAzimutBeamAngle",
ncShort,(const NcDim*)lp_dim[0], (const NcDim*)lp_dim[1]);
  lp_var->add_att("type", "real");
  lp_var->add_att("long_name", "Beam azimut");
  lp_var->add_att("name_code", "MB_AZIMUT_BEAM_ANGLE");
  lp_var->add_att("units", "degree");
  lp_var->add_att("unit_code", "MB_DEGREE");
  lp_var->add_att("add_offset", 0.0);
  lp_var->add_att("scale_factor", 0.01);
  lp_var->add_att("valid_minimum", 0);
  lp_var->add_att("valid_maximum", 35999);
  lp_var->add_att("missing_value", 32767);
  lp_var->add_att("format_C", "%.2f");
  lp_var->add_att("orientation", "direct");

  long lv_nbData = lp_dim[0]->size()*lp_dim[1]->size();
  short* lp_tabData = new short[lv_nbData];
  for (long lv_i=0; lv_i< lv_nbData;lv_i++)
    lp_tabData[lv_i]=32767;
  lp_var->put(lp_tabData, lp_var->edges());

  lp_fichier->close();
  // liberation des ressources
  delete [] lp_tabData;

Have you an idea or better a solution

Have a nice day
Alain


--
alain.mazurier@xxxxxx - Atlantide - http://www.ago.fr
Technopole Brest Iroise BP 80802 - 29608 Brest cedex - France -
Tel. : +33 (0)2 98 05 43 21 - Fax. : +33 (0)2 98 05 20 34
e-mail: atlantide-brest@xxxxxx
Centre Affaires Oberthur - 74D, rue de Paris -  35700 Rennes - France
Tel. : +33 (0)2 1999 84 15 84 - Fax : +33 (0)2 1999 84 15 85
e-mail: atlantide-rennes@xxxxxx
--
EPSHOM/GG/SMF : Tel.: 33 (0)2 98.22.17.73 - mazurier@xxxxxxx




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