[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #WDR-562907]: scalar string variable



Is this of any use?
https://www.unidata.ucar.edu/software/netcdf/docs/group__variables.html#ga64cd065d752a079867ba4fe93d7cc1e0

> Ward,
> 
> I have downloaded a developer version of code v.4.5.0.0 and I have found
> there the Doxyfile.developer. I have generated the documentation,
> thanks. But I couldn't find there a description of how to work with
> strings. A good description would still be very much appreciated. In the
> meanwhile, I will try to understand the test source code. If there are
> any additional examples or descriptions available regarding the text and
> string variables, please point me to them or email them to me.
> 
> Thanks for your help,
> 
> Alex
> 
> 
> On 11/20/2017 6:00 PM, Alexander Ken wrote:
> > Hi Ward,
> >
> > I am still having difficulties to find documentation or to understand
> > how to work with string variables. I have source for netcdf v 4.3.3.1,
> > but there is no Doxyfile.developer file in the docs. Is there a
> > Doxygen documentation available online?
> >
> > Thanks,
> >
> > Alex
> >
> >
> > On 8/8/2017 3:53 PM, Unidata netCDF Support wrote:
> >> Hi Alex,
> >>
> >> Yes, nc_put/get_vara() is used to write/read arrays of data. Hence
> >> the **.
> >> You would use nc_put_var with char*. I don’t believe a cleanup is
> >> required,
> >> other than freeing memory once you are done with it. I will double check
> >> that.
> >>
> >> If you have doxygen and graphviz installed locally, there is a
> >> Doxyfile.developer configuration file in the docs/ directory which is
> >> distributed with the netCDF source code. You can generate *very*
> >> comprehensive documentation as follows, from the root source directory:
> >>
> >> $ doxygen docs/Doxyfile.developer
> >> $ [browser of choice] html/index.html
> >>
> >> This is a terrific developer resource and makes jumping around the
> >> API/source code very easy. It is a tool I use frequently.
> >>
> >> I hope this helps!
> >>
> >> -Ward
> >>
> >> address@hidden> wrote:
> >>
> >> New Client Reply: scalar string variable
> >>> Ward,
> >>>
> >>> thanks! Is it that one needs always to use nc_put_vara with parameter
> >>> char** ? Can one use nc_put_var with parameter char*?
> >>>
> >>> Also, how about nc_get_var and nc_get_vara? I have read that one needs
> >>> to call a clean up function, correct?
> >>>
> >>> I hope those are my last questions regarding this topic. Thank you for
> >>> helping!
> >>>
> >>> Alex
> >>>
> >>>
> >>> On 8/8/2017 3:13 PM, Unidata netCDF Support wrote:
> >>>> Hi Alex,
> >>>>
> >>>> No problem! I've attached the CDL and generated test file from it. 
> >>>> For
> >>> the
> >>>> record, I'm generating the C file as follows:
> >>>>
> >>>>       $ ncgen -l c -k nc4 test_with_data.cdl > test_with_data.c
> >>>>
> >>>> Thanks, I hope this helps!
> >>>>
> >>>> -Ward
> >>>>
> >>>>
> >>>> address@hidden> wrote:
> >>>>
> >>>>> New Client Reply: scalar string variable
> >>>>>
> >>>>> Ward,
> >>>>>
> >>>>> thank you very much! Would it be much trouble if I ask about examples
> >>>>> for "put" and "get" for this variable (adding in the section /*
> >>>>> assign
> >>>>> variable data */)?
> >>>>>
> >>>>> Thanks,
> >>>>>
> >>>>> Alex
> >>>>>
> >>>>>
> >>>>> On 8/8/2017 1:03 PM, Unidata netCDF Support wrote:
> >>>>>> Oh! Yes, I'm sorry :).
> >>>>>>
> >>>>>> I've attached a C program which generates the netCDF file
> >>>>>> described by
> >>>>> the
> >>>>>> CDL below.  An interesting feature of ncgen is that, while it
> >>> generates a
> >>>>>> binary netCDF file by default, you can also have it generate a C (or
> >>>>> Java)
> >>>>>> program that, when compiled and run, will also generate the file.  I
> >>> use
> >>>>>> this as an easy way to investigate the API, sometimes.  Rather than
> >>>>>> describe the API to use, I'm providing this program as a working
> >>> example.
> >>>>>> If it is insufficient or doesn't answer your question, please let me
> >>>>> know!
> >>>>>> I hope this helps!
> >>>>>>
> >>>>>> -Ward
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> address@hidden> wrote:
> >>>>>>
> >>>>>>> New Client Reply: scalar string variable
> >>>>>>>
> >>>>>>> Ward,
> >>>>>>>
> >>>>>>> thank you very much. I meant: how can the variable be created using
> >>> the
> >>>>>>> C API?
> >>>>>>>
> >>>>>>> Thanks,
> >>>>>>> Alex
> >>>>>>>
> >>>>>>>
> >>>>>>> On 8/7/2017 3:58 PM, Unidata netCDF Support wrote:
> >>>>>>>> Hello Alex,
> >>>>>>>>
> >>>>>>>> The phony_dim_0 is used because there is no dimension available in
> >>> the
> >>>>>>> file you've created.  It is created dynamically and is not stored
> >>> within
> >>>>>>> the file, because a variable in the netCDF data model requires at
> >>> least
> >>>>> one
> >>>>>>> dimension.
> >>>>>>>> I am not familiar with the hdf5 tools, but the CDL to create
> >>>>>>>> what you
> >>>>>>> are describing should work; simply change the 'pony_dim_0' value
> >>>>>>> to 20
> >>>>> and
> >>>>>>> perhaps rename the dimension, such as the following:
> >>>>>>>> netcdf test {
> >>>>>>>> dimensions:
> >>>>>>>>          dim_0 = 20 ;
> >>>>>>>> variables:
> >>>>>>>>          string mystring(dim_0) ;
> >>>>>>>>
> >>>>>>>> }
> >>>>>>>>
> >>>>>>>> If that were in a file named 'test.cdl', you could then generate a
> >>>>>>> binary netcdf file using the ncgen utility as follows:
> >>>>>>>>         $ ncgen -k nc4 -o test.nc test.cdl
> >>>>>>>>
> >>>>>>>> If you then queried the contents using the ncdump utility, you
> >>>>>>>> would
> >>>>> see
> >>>>>>> the following:
> >>>>>>>> ````
> >>>>>>>> netcdf test {
> >>>>>>>> dimensions:
> >>>>>>>>          dim_0 = 20 ;
> >>>>>>>> variables:
> >>>>>>>>          string mystring(dim_0) ;
> >>>>>>>> data:
> >>>>>>>>
> >>>>>>>>      mystring = _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
> >>>>>>>> _, _,
> >>> _,
> >>>>> _ ;
> >>>>>>>> }
> >>>>>>>> ````
> >>>>>>>>
> >>>>>>>> In terms of creating a variable using the hdfview or other 3rd
> >>>>>>>> party
> >>>>>>> tools, I'm afraid I can't say as I'm unfamiliar with them.  It
> >>>>>>> should
> >>> be
> >>>>>>> possibly using the netCDF utilities, however.
> >>>>>>>> I hope this helps,
> >>>>>>>>
> >>>>>>>> -Ward
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> Dear Madam or Sir,
> >>>>>>>>>
> >>>>>>>>> Is it possible to create scalar string variables using NetCDF
> >>>>> library? I
> >>>>>>>>> have used hdfview and created a string variable, which is
> >>>>>>>>> reported
> >>> as
> >>>>>>>>> "char s(1,20)" by Panoply and as "s (800, 2) String, length = 20,
> >>>>> 1"
> >>>>>>>>> by hdfview.
> >>>>>>>>>
> >>>>>>>>> The ncdump reports:
> >>>>>>>>>
> >>>>>>>>> "netcdf new {
> >>>>>>>>> dimensions:
> >>>>>>>>> phony_dim_0 = 1 ;
> >>>>>>>>> variables:
> >>>>>>>>> string s(phony_dim_0) ;
> >>>>>>>>> }"
> >>>>>>>>>
> >>>>>>>>> The "phony_dim_0" is not reported neither by hdfview nor by
> >>>>>>>>> Panoply.
> >>>>> How
> >>>>>>>>> would you suggest creating such a variable or any other scalar
> >>> string
> >>>>>>>>> variable?
> >>>>>>>>>
> >>>>>>>>> Thank you,
> >>>>>>>>>
> >>>>>>>>> Alex
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> Ticket Details
> >>>>>>>> ===================
> >>>>>>>> Ticket ID: WDR-562907
> >>>>>>>> Department: Support netCDF
> >>>>>>>> Priority: Normal
> >>>>>>>> Status: Closed
> >>>>>>>> ===================
> >>>>>>>> NOTE: All email exchanges with Unidata User Support are
> >>>>>>>> recorded in
> >>> the
> >>>>>>> Unidata inquiry tracking system and then made publicly available
> >>> through
> >>>>>>> the web.  If you do not want to have your interactions made
> >>>>>>> available
> >>> in
> >>>>>>> this way, you must let us know in each email you send to us.
> >>>>>>>
> >>>>>>> Ticket Details
> >>>>>>> ===================
> >>>>>>> Ticket ID: WDR-562907
> >>>>>>> Department: Support netCDF
> >>>>>>> Priority: Normal
> >>>>>>> Status: Open
> >>>>>>> Link: https://andy.unidata.ucar.edu/esupport/staff/index.php?_m=
> >>>>>>> tickets&_a=viewticket&ticketid=28537
> >>>>>>>
> >>>>>>>
> >>>>>> Ticket Details
> >>>>>> ===================
> >>>>>> Ticket ID: WDR-562907
> >>>>>> Department: Support netCDF
> >>>>>> Priority: Normal
> >>>>>> Status: Open
> >>>>>> ===================
> >>>>>> NOTE: All email exchanges with Unidata User Support are recorded
> >>>>>> in the
> >>>>> Unidata inquiry tracking system and then made publicly available
> >>>>> through
> >>>>> the web.  If you do not want to have your interactions made
> >>>>> available in
> >>>>> this way, you must let us know in each email you send to us.
> >>>>>
> >>>>>
> >>>>>
> >>>>> Ticket Details
> >>>>> ===================
> >>>>> Ticket ID: WDR-562907
> >>>>> Department: Support netCDF
> >>>>> Priority: Normal
> >>>>> Status: Open
> >>>>> Link: https://andy.unidata.ucar.edu/esupport/staff/index.php?_m=
> >>>>> tickets&_a=viewticket&ticketid=28537
> >>>>>
> >>>>>
> >>>>
> >>>> Ticket Details
> >>>> ===================
> >>>> Ticket ID: WDR-562907
> >>>> Department: Support netCDF
> >>>> Priority: Normal
> >>>> Status: Open
> >>>> ===================
> >>>> NOTE: All email exchanges with Unidata User Support are recorded in
> >>>> the
> >>> Unidata inquiry tracking system and then made publicly available
> >>> through
> >>> the web.  If you do not want to have your interactions made
> >>> available in
> >>> this way, you must let us know in each email you send to us.
> >>>
> >>>
> >>>
> >>> Ticket Details
> >>> ===================
> >>> Ticket ID: WDR-562907
> >>> Department: Support netCDF
> >>> Priority: Normal
> >>> Status: Open
> >>> Link: https://andy.unidata.ucar.edu/esupport/staff/index.php?_m=
> >>> tickets&_a=viewticket&ticketid=28537
> >>>
> >>> ?
> >>
> >>
> >> Ticket Details
> >> ===================
> >> Ticket ID: WDR-562907
> >> Department: Support netCDF
> >> Priority: Normal
> >> Status: Open
> >> ===================
> >> NOTE: All email exchanges with Unidata User Support are recorded in
> >> the Unidata inquiry tracking system and then made publicly available
> >> through the web.  If you do not want to have your interactions made
> >> available in this way, you must let us know in each email you send to
> >> us.
> >>
> >>
> >
> 
> 

=Dennis Heimbigner
  Unidata


Ticket Details
===================
Ticket ID: WDR-562907
Department: Support netCDF
Priority: Critical
Status: Open
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.