That's solved that issue (I hope this will also be added to the mailing
list)
My last question is at the moment when you look at the individual
variables they are plotted against the sample number and I actually need
them against the first variable Time. With the current code I have how
do I achieve changing the variable so it is time instead of sample
number based
Thank you
I have added the current working code to help any others:
Private Sub WriteTestFile(ByVal name As String)
Dim ncid As Int32
Dim dimid As Int32
Dim varid As Int32
Dim dimids(0) As Integer
Dim res As Int32
'Create a netcdf file and write a bunch of stuff to it.
res = NetCDF.nc_create(name, NetCDF.cmode.NC_CLOBBER, ncid)
If (res <> 0) Then GoTo err
'Define dimensions
res = NetCDF.nc_def_dim(ncid, "Time", UBound(TimerB), dimid)
If (res <> 0) Then GoTo err
res = NetCDF.nc_def_dim(ncid, "V", UBound(G1V), dimid)
If (res <> 0) Then GoTo err
res = NetCDF.nc_def_dim(ncid, "I", UBound(G1I), dimid)
If (res <> 0) Then GoTo err
'varids will start at 0
dimids(0) = 0
res = NetCDF.nc_def_var(ncid, "SS_Time", NetCDF.nc_type.NC_FLOAT, 1,
dimids, varid)
If (res <> 0) Then GoTo err
'varid will be 1
dimids(0) = 1
res = NetCDF.nc_def_var(ncid, "SS_G1_Volts",
NetCDF.nc_type.NC_FLOAT, 1, dimids, varid)
If (res <> 0) Then GoTo err
'varid will be 2
dimids(0) = 2
res = NetCDF.nc_def_var(ncid, "SS_G1_Current",
NetCDF.nc_type.NC_FLOAT, 1, dimids, varid)
If (res <> 0) Then GoTo err
'Write Variable Attributes
res = NetCDF.nc_put_att_text(ncid, 0, "Long_Name", 33, "SS Time
Referenced To Pulse Start")
res = NetCDF.nc_put_att_text(ncid, 0, "Units", 5, "s")
res = NetCDF.nc_put_att_text(ncid, 1, "Long_Name", 17, "SS Grid 1
Voltage")
res = NetCDF.nc_put_att_text(ncid, 1, "Units", 5, "kV")
res = NetCDF.nc_put_att_text(ncid, 2, "Long_Name", 17, "SS Grid 1
Current")
res = NetCDF.nc_put_att_text(ncid, 2, "Units", 5, "A")
res = NetCDF.nc_enddef(ncid)
If (res <> 0) Then GoTo err
'Write Variables to File
res = NetCDF.nc_put_var_float(ncid, 0, TimerB)
If (res <> 0) Then GoTo err
res = NetCDF.nc_put_var_float(ncid, 1, G1V)
If (res <> 0) Then GoTo err
res = NetCDF.nc_put_var_float(ncid, 2, G1I)
If (res <> 0) Then GoTo err
'Close the netCDF file.
res = NetCDF.nc_close(ncid)
If (res <> 0) Then GoTo err
Exit Sub
err:
MsgBox("error:" & NetCDF.nc_strerror(res))
End Sub
__________________________
David A. Homfray
MAST NB Operations Manager
Culham Centre for Fusion Energy
D3/2.68, Culham Science Centre
Abingdon OX14 3DB
T +44(0)1235 466952
F +44(0)1235 466511
M +44(0) 7971 091930
E david.homfray@xxxxxxxxxx
www.ccfe.ac.uk <http://www.ccfe.ac.uk/>
__________________________
-----Original Message-----
From: netcdfgroup-bounces@xxxxxxxxxxxxxxxx
[mailto:netcdfgroup-bounces@xxxxxxxxxxxxxxxx] On Behalf Of Yair suari
Sent: 25 May 2011 21:31
To: netcdfgroup@xxxxxxxxxxxxxxxx
Subject: Re: [netcdfgroup] netcdfgroup Digest, Vol 392, Issue 1
I have not worked with the VB netcdf wrapper myself but i did
work a bit with netcdf and with vb.
from what i see th vb wrapper uses the C function names. and
what you want to do is add two attributes to your variables
one called longname and one units
you would end up using:
something like:
stat = nc_put_att_text(sr_ncid, lat_id, "long_name", 8,
"Latitude");
you could look at the attributes functions documentation
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c/Attributes.htm
l#Attributes
On Wed, May 25, 2011 at 9:00 PM,
<netcdfgroup-request@xxxxxxxxxxxxxxxx> wrote:
Send netcdfgroup mailing list submissions to
netcdfgroup@xxxxxxxxxxxxxxxx
To subscribe or unsubscribe via the World Wide Web,
visit
http://mailman.unidata.ucar.edu/mailman/listinfo/netcdfgroup
or, via email, send a message with subject or body
'help' to
netcdfgroup-request@xxxxxxxxxxxxxxxx
You can reach the person managing the list at
netcdfgroup-owner@xxxxxxxxxxxxxxxx
When replying, please edit your Subject line so it is
more specific
than "Re: Contents of netcdfgroup digest..."
Today's Topics:
1. Adding units and long name to variables using
VB.net wrapper
(Homfray, David A)
----------------------------------------------------------------------
Message: 1
Date: Wed, 25 May 2011 12:23:45 +0100
From: "Homfray, David A" <David.Homfray@xxxxxxxxxx>
To: <netcdfgroup@xxxxxxxxxxxxxxxx>
Subject: [netcdfgroup] Adding units and long name to
variables using
VB.net wrapper
Message-ID:
<A63153883A27C248965F00B5FB03685F50821D@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
Content-Type: text/plain; charset="us-ascii"
Hi
I am new to the netCDF format and using the VB.net
wrapper (created by
Ed Hartnett) to create netCDF data. I am able to create
the three data
sets of interest but would like to add the units and
long name to each
variable. I am unsure how to do it using the VB.net
wrapper and would
appreciate any help in solving my problem
Regards
David
__________________________
David A. Homfray
MAST NB Operations Manager
Culham Centre for Fusion Energy
D3/2.68, Culham Science Centre
Abingdon OX14 3DB
T +44(0)1235 466952
F +44(0)1235 466511
M +44(0) 7971 091930
E david.homfray@xxxxxxxxxx
www.ccfe.ac.uk <http://www.ccfe.ac.uk/>
__________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mailman.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/atta
chments/20110525/1646a052/attachment.html>
------------------------------
_______________________________________________
netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit:
http://www.unidata.ucar.edu/mailing_lists/
End of netcdfgroup Digest, Vol 392, Issue 1
*******************************************
--
Yair Suari
Geva Carmel, Israel 30855
Phone-0528-524520, 04-9840943