Hi,
I would like to write an array of data to a text file, similar to this
request from a previous thread:
http://www.ncl.ucar.edu/Support/talk_archives/2012/0230.html
I have chosen to use WRAPIT to write my data to disk.
I am trying to pass an array to an f90 subroutine, but NCL/WRAPIT keeps
telling me that my array is not dimensioned correctly.
I have an array defined in the driving NCL script as:
xtas(ntim,nmod), where ntim=34675, nmod=33
I would like to pass this array to a f90 routine. When I try and do this,
the routine expects xtas to be dimensioned xtas(nmod,ntim) which is NOT how
it is defined in the driving NCL script...
fatal:writearr: dimension size of dimension (1) of xtas must be equal to
the value of ntim
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 226 in
file extract_BCSD_lat_lon.ncl
The call to the routine in the NCL script is:
WRITEARRAY::writearr(ntim,nmod,xtas)
Immediately before calling the f90 routine, I do "printVarSummary(xtas)"...
I get...
Variable: xtas
Type: float
Total Size: 4577100 bytes
1144275 values
Number of Dimensions: 2
Dimensions and sizes: [34675] x [33]
Coordinates:
Number Of Attributes: 1
_FillValue : -999.999
The print summary for xtas is as expected...xtas(ntim,nmod)...
my stub file is:
C NCLFORTSTART
subroutine writearr(ntim,nmod,xtas)
integer ntim,nmod
real xtas(ntim,nmod)
C NCLEND
my f90 routine is:
subroutine writearr(ntim,nmod,xtas)
integer ntim, nmod
real xtas(ntim,nmod)
print*, xtas
return
end subroutine writearr
Both compile with no errors.
Other info:
WRAPIT Version: 120209
OPERATING SYSTEM: Darwin
FORTRAN COMPILER (f90c): gfortran
FORTRAN COMPILER OPTIONS (fopts): -m64 -fPIC -v -c -fno-second-underscore
gcc -m64 -c -fno-common -I/usr/local/ncl-6.1.2/include WRAPIT.c
COMPILING writearr.f90
gfortran -m64 -fPIC -v -c -fno-second-underscore writearr.f90
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin11/4.6.2/lto-wrapper
Target: x86_64-apple-darwin11
Configured with: ../gcc-4.6.2-RC-20111019/configure
--prefix=/usr/local/gfortran
--with-gmp=/Users/fx/devel/gcc/deps-static/x86_64
--enable-languages=c,c++,fortran,objc,obj-c++ --build=x86_64-apple-darwin11
Thread model: posix
gcc version 4.6.2 20111019 (prerelease) (GCC)
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.3' '-m64' '-fPIC' '-v' '-c'
'-fno-second-underscore' '-mtune=core2'
/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin11/4.6.2/f951
writearr.f90 -fPIC -quiet -dumpbase writearr.f90
-mmacosx-version-min=10.8.3 -m64 -mtune=core2 -auxbase writearr -version
-fPIC -fno-second-underscore -fintrinsic-modules-path
/usr/local/gfortran/lib/gcc/x86_64-apple-darwin11/4.6.2/finclude -o
/var/folders/fl/p8bxmn6x0gb7vk2qlzv90bdh0000gn/T//cc8VXUoN.s
GNU Fortran (GCC) version 4.6.2 20111019 (prerelease)
(x86_64-apple-darwin11)
compiled by GNU C version 4.6.2 20111019 (prerelease), GMP version 5.0.2,
MPFR version 3.0.1-p4, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (GCC) version 4.6.2 20111019 (prerelease)
(x86_64-apple-darwin11)
compiled by GNU C version 4.6.2 20111019 (prerelease), GMP version 5.0.2,
MPFR version 3.0.1-p4, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.3' '-m64' '-fPIC' '-v' '-c'
'-fno-second-underscore' '-mtune=core2'
as -arch x86_64 -force_cpusubtype_ALL -o writearr.o
/var/folders/fl/p8bxmn6x0gb7vk2qlzv90bdh0000gn/T//cc8VXUoN.s
COMPILER_PATH=/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin11/4.6.2/:/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin11/4.6.2/:/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin11/:/usr/local/gfortran/lib/gcc/x86_64-apple-darwin11/4.6.2/:/usr/local/gfortran/lib/gcc/x86_64-apple-darwin11/
LIBRARY_PATH=/usr/local/gfortran/lib/gcc/x86_64-apple-darwin11/4.6.2/:/usr/local/gfortran/lib/gcc/x86_64-apple-darwin11/4.6.2/../../../:/usr/lib/
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.3' '-m64' '-fPIC' '-v' '-c'
'-fno-second-underscore' '-mtune=core2'
SHARED OBJECT NAME (SharedObj): writearr2.so
LINKER SUFFIX (ld_suffix): WRAPIT.o writearr.o -L/usr/local/gfortran/lib/
-o writearr2.so
LINKING
gcc -m64 -bundle -flat_namespace -undefined suppress WRAPIT.o writearr.o
-L/usr/local/gfortran/lib/ -o writearr2.so -lgfortran
END WRAPIT
I must be missing something here. I am not trying to do anything
complicated. Thanks in advance.
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 26 08:48:17 2013
This archive was generated by hypermail 2.1.8 : Fri Aug 30 2013 - 14:04:57 MDT