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

[netCDF #WDR-562907]: scalar string variable



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.