NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
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 DoubleIf 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 stepcount(2) = lNumLat 'All the latitudes and longitudes please
count(3) = lNumLonstride(1) = 1
stride(2) = 1 stride(3) = 1imap(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
From owner-netcdfgroup@xxxxxxxxxxxxxxxx 17 2004 Sep -0700 15:31:39
Date: 17 Sep 2004 15:31:39 -0700 From: Shulan Liu <shulan@xxxxxxx> To: netcdfgroup@xxxxxxxxxxxxxxxx Subject: netcdf in Itanium2/efc7.1 Received: (from majordo@localhost) by unidata.ucar.edu (UCAR/Unidata) id i8HMW9ar026518 for netcdfgroup-out; Fri, 17 Sep 2004 16:32:09 -0600 (MDT) Keywords: 200409172232.i8HMW5nJ026494 Content-Type: text/plain Organization: DRI Message-Id: <1095460299.1908.106.camel@xxxxxxxxxxxxx> Mime-Version: 1.0X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Content-Transfer-Encoding: 7bit
Sender: owner-netcdfgroup@xxxxxxxxxxxxxxxx Precedence: bulk Reply-To: Shulan Liu <shulan@xxxxxxx> Hi, I thought I made it last time I compiled netcdf in our SGI Altix (Itanium2/efc7.1). But due to an error related to netcdf when running another program, I found that I still couldn't make the test case --- it prompted error on testing f90 netcdf lib. Here is the environment I use: CC=ecc FC=efc F90=efc CXX=efc CPP="/usr/bin/cpp -C -P -traditional" CFLAGS="-O" F90FLAGS="-O " CPPFLAGS="-DNDEBUG -DpgiFortran" FFLAGS="-mp" FLIBS="/usr/local/intel/compiler70/ia64/lib/libPEPCF90.a" then I do ./configure, "make" seems to work without an error. But at "make test", at testing f90 libs, it gave: call check(nf90_put_var(ncFileID, lonVarId, (/ -180, -175, -170 /) Error 259 at (78:netcdf_test.f90) : This function has the wrong numberof arguments or arguments with the wrong name, type or rank
Any suggestions, many thanks, Shulan
From owner-netcdfgroup@xxxxxxxxxxxxxxxx 17 2004 Sep -0700 15:59:05
Date: 17 Sep 2004 15:59:05 -0700 From: Shulan Liu <shulan@xxxxxxx> To: netcdfgroup@xxxxxxxxxxxxxxxx Subject: netcdf "make test" Received: (from majordo@localhost) by unidata.ucar.edu (UCAR/Unidata) id i8HMxV3C000103 for netcdfgroup-out; Fri, 17 Sep 2004 16:59:31 -0600 (MDT) Keywords: 200409172259.i8HMxUnJ000097 Content-Type: text/plain Organization: DRI Message-Id: <1095461945.1908.118.camel@xxxxxxxxxxxxx> Mime-Version: 1.0X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Content-Transfer-Encoding: 7bit
Sender: owner-netcdfgroup@xxxxxxxxxxxxxxxx Precedence: bulk Reply-To: Shulan Liu <shulan@xxxxxxx> Hi, my last email was based on a slightly older version of netcdf than 3.5.1. For the current version, with the same environment variables, I got following errors at "make test": (also at testing f90) ./netcdf_test Invalid dimension id or name Variable not found Variable not found Variable not found Variable not found Variable not found Variable not found example_good.cdl example.cdl differ: char 125, line 8 *** Failure *** I also attached the whole log file for "make log". Thanks in advance, Shulan
netcdfgroup
archives: