changing SDS name

How would one go about changing a SDS name? I have a HSF4 file that has a SDS
called A and I want to change it to B. All the data inside the SDS is good,
but the name needs changing.

Thoughts?

Thanks, Brock

Hi Brock,

SDsetdimname will do what you want.

Binh-Minh

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of Brock Murch
Sent: Friday, June 24, 2011 12:43 PM
To: hdf-forum@hdfgroup.org
Subject: [Hdf-forum] changing SDS name

How would one go about changing a SDS name? I have a HSF4 file that has a
SDS
called A and I want to change it to B. All the data inside the SDS is good,
but the name needs changing.

Thoughts?

Thanks, Brock

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.0/1778 - Release Date: 11/9/2008
2:14 PM

Hello again, Brock!

I misread your message, thinking that you wanted to change the dimension's
name, hence, suggested SDsetdimname.

You cannot change the SDS's name directly in the SD interface, but you can
work around it by using the Vgroup interface because, internally, an SDS is
represented by a vgroup. Our user support rep caught my mistake and offered
the example below. After changing the SDS this way, you should be able to
see its new name in the SD interface.

My apology for the mix-up. Please let us know if you have further
questions.
Binh-Minh
----------------- Work around to change SDS' name --------------
#include "hdf.h"

main( )
{

      int32 file_id, vg_id, vg_ref;
      intn status;

      /* Open the HDF file. */
      file_id = Hopen("sd.hdf", DFACC_WRITE, 0);
      printf ("Hopen returns: %i\n", file_id);

      /* Initialize HDF Vgroup/Vdata interface. */
      status = Vstart(file_id);
      printf ("Vstart returns: %i\n", status);

  /* Look for the vgroup that represents "SDS A" */
      vg_ref = Vfind(file_id, "SDS A");
      printf ("Vfind returns: %i\n", vg_ref);

      if (vg_ref > 0)
      {
         /* Get access to the vgroup */
         vg_id = Vattach (file_id, vg_ref, "w");
         printf ("Vattach returns: %i\n", vg_id);

     /* Change from "SDS A" to "SDS B" */
         status = Vsetname(vg_id, "SDS B");
         printf ("Vsetname returns: %i\n", status);

         /* Terminate access to the vgroup. */
         status = Vdetach(vg_id);
         printf ("Vdetach returns: %i\n", status);
      }

      /* Terminate access to the Vgroup interface and close the file. */
      status = Vend(file_id);
      printf ("Vend returns: %i\n", status);
      status = Hclose(file_id);
      printf ("Hclose returns: %i\n", status);

}

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of Binh-Minh Ribler
Sent: Friday, June 24, 2011 1:43 PM
To: bmurch@mail.usf.edu; 'HDF Users Discussion List'
Subject: Re: [Hdf-forum] changing SDS name

Hi Brock,

SDsetdimname will do what you want.

Binh-Minh

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of Brock Murch
Sent: Friday, June 24, 2011 12:43 PM
To: hdf-forum@hdfgroup.org
Subject: [Hdf-forum] changing SDS name

How would one go about changing a SDS name? I have a HSF4 file that has a
SDS
called A and I want to change it to B. All the data inside the SDS is good,
but the name needs changing.

Thoughts?

Thanks, Brock

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.0/1778 - Release Date: 11/9/2008
2:14 PM

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.0/1778 - Release Date: 11/9/2008
2:14 PM