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

20010201: netcdf F90 problem/issue



Sergio,

You've made an interesting observation.  We'll have to discuss it
together with the developer of the Fortran-90 interface.

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>

>To: address@hidden
>From: Sergio Derada <address@hidden>
>Subject: netcdf F90 problem/issue
>Organization: UCAR/Unidata
>Keywords: 200102011851.f11IpbX18715

> I am migrating my netcdf software to the latest version and
> incorporating the F90 interface. I've got to a "sticky" point which
> even though may not have an easy solution/work-around, I think you
> should know it as it is an important issue in "generic" software. If you
> can help with this, great! If you can't, maybe the F90 interface needs a
> revision to support this. I'll summarize my problem as follows:
> 
> All my software is generic, so it reads/writes netcdf files in the most
> generic ways, assuming the user/programmer knows little or nothing about
> the data format/abstraction. More specifically, the
> user does not know the number of dimensions at the time of execution,
> the software reports the number
> of dimensions per variable. What this means is that all my declarations
> are pointers which get allocated
> upon reading the dimensions for each variable. This works in the Fortran
> interface, but does not work in
> your F90 interface because you are assuming dimensionality in your
> overloaded functions.
> 
> PSUEDOCODE EXAMPLE
> 
> real, dimension(:), pointer, :: rdata  ! no dimensionality
> 
> Once dimensions for variables found via NF90_INQUIRE_VARIABLE (assume
> 2x4)
> then ALLOCATE(rdata(product_of_dimensions))
> 
> Once memory allocated, read data via  NF90_GET_VAR(cdfid, varnum, rdata)
> 
> ! this does not work,(overload thinks it is a 1D array (as declared),
> but it's really 2D data)
> 
> ! Again, any of the NF_GET_VAR routines, works fine.
> 
> 
> ----------------
> Let me know what you think or if you need more detail or code.
> 
> Thanks,
> Sergio deRada
> NRL/SVT-code-7330