Hi Matthew,
I don´t have a solution for your problem, but instead have a question:
I was very excited that you can use the netcdf functions in VB6. I tried
that too, but always get an error message "invalid DLL calling convention"
(or so, that´s my translation to english of the error message).
Here is what I have tried:
1. I created a new "Standard exe" in VB6
2. In a new module I wrote:
Public Declare Function nc_open Lib "netcdf.dll" (ByVal path As String,
ByVal cmode As Integer, ByRef ncidp As Integer) As Integer
3. I tried to use the function in a Sub-procedure:
Sub main
Dim path as String, res as integer, ncidp as integer
path="C:\blrub.cdf" 'a valid path to a netcdf file
res=nc_open(path,0,ncidp)
End Sub
When I run this, I get the above mentioned errror message.
What I am doing wrong? Is there any "trick" or special requirement?
In VB.NET, this works fine!
Thanks and best regards
H.J. Rieger
> I need some help with doing index mapping in NetCDF v. 3.5.0 using VB
> 6. I just want to transpose two indices in a NetCDF variable but it
> won't work.
> I have spent a whole day of crashing VB and I haven't got anywhere. My
> netcdf api hasn't failed me until now. I am trying to use the function
>
> Public Declare Function nc_get_varm_double Lib "netcdf.dll" (ByVal ncid
> As Long, ByVal varid As Long, ByRef startp As Long, ByRef countp As
> Long, ByRef stridep As Long, ByRef imapp As Long, ByRef ip As Double) As
> Long
>
> Firstly, I am hoping the above is correct. It is based on all my other
> netcdf api conversions but to date I have only done read/write of netcdf
> files with single value, array and subarray functions. I have never
> tried anything like this before.
>
> My netcdf file has dimensions for lon, lat, and time. I have coordinate
> variables for each as well. I also have a data variable declared as:
> short water_u(time, lat, lon) ;
> water_u:long_name = "Eastward Water Velocity" ;
> water_u:units = "meters/second" ;
> water_u:_FillValue = -10000s ;
> water_u:scale_factor = 0.01f ;
> water_u:add_offset = 0.f ;
>
> I need to read this into a VB variable declared as:
> Dim WaterU(1 To lNumLat, 1 To lNumLon) As Double
>
> If it wasn't for the fact that the array indices must be in this order I
> would be fine. I could just transpose after read the
> NetCDF variable but it very ineligent and rather slow in VB so I prefer
> using the NetCDF api. This is what I am trying to do now:
>
> Dim dims(1 To 3) As Long, count(1 To 3) As Long, stride(1 To 3) As
> Long, imap(1 To 3) As Long
>
> dims(1) = lCurrentTime - 1 'VB arrays are base 1 for me so I
> must subtract 1 to get NetCDF array index
> dims(2) = 0
> dims(3) = 0
>
> count(1) = 1 'Only 1 time step
> count(2) = lNumLat 'All the latitudes and
> longitudes please
> count(3) = lNumLon
>
> stride(1) = 1
> stride(2) = 1
> stride(3) = 1
>
> imap(1) = 1 '** I am guessing my
> problem is here but no combination of numbers has worked for me
> imap(2) = nLon
> imap(3) = CLng(nLat * nLon)
>
> NcErr = nc_get_varm_double(fHandle, var_id, dims(1), count(1),
> stride(1), imap(1), dblArray(1, 1))
> If NcErr <> 0 Then GoTo NcErrOut
>
> Thanks in advance for any help!
> Matthew Hanna
>
>
--
GMX ProMail mit bestem Virenschutz http://www.gmx.net/de/go/mail
+++ Empfehlung der Redaktion +++ Internet Professionell 10/04 +++