Hi there,
I have a problem using a FORTRAN 77 code to read ASCII data into NCL to plot. The data I try to read is TOMS OMI aerosol index and the FORTRAN 77 code is provided at TOMS ftp site. I followed the steps in http://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml to write special wrapper text, run WRAPIT and load the shared object and call the routine. This seems to be good. But when I run my NCL script, it didn't show ANY result (However, it is supposed to print the information of the the data (for the "print(var)" command) which is read in, and a plot). NO error information is shown, either. When I add a "write" statement in the fortran code (as you can find in my f code), the data can be shown on the commandline when I run NCL. But still, there is NO result from NCL. I think this indicated that the f subrountine can be called by NCL, but there is some problem in transfering data array into NCL. I am wondering if anyone can help to solve this problem? Thanks!
BW: I used NCL Version 5.1.1 on Linux X86_64 platform. I have tested the ex.f and ex.ncl at WRAPIT webpage. And it can be run successfully.
The fortran code to read the data: (This code is OK to run separately. And it needs a string as filename input)
c this program reads the daily gridded data for real-time OMI
c data for January 31, 2007. variables lat and lon contain the
c latitudes and longitudes of the center of each of the grid
c cells in the array AI.
C NCLFORTSTART
subroutine read_aersl_omi(fname,lat,lon,ai)
character*80 header
integer*4 ai
real*4 lat(180), lon(360)
character*(*) fname
dimension ai(360,180)
C NCLEND
c calculate latitudes and longitudes
c
dlat = 1.0
do 10 i=1,180
lat(i) = -89.5 + (i-1)*dlat
10 continue
dlon = 1.0
do 20 i=1,360
lon(i) = -179.5 + (i-1)*dlon
20 continue
c
c open the input file
c
cc open(1,file='L3_aersl_omi_20051231.txt',status='old')
open(1,file=fname,status='old')
c
c read in the header lines
c
read(1,'(a80)') header
read(1,'(a80)') header
read(1,'(a80)') header
c
c read in the data into the array ozone
c
do 30 i=1,180
read(1,'(1x,25i3)') (ai(j,i),j=1,360)
30 continue
c
c close the input file
c
close(1)
c
c process/print the ai data
c write(*,*) ai
stop
end
Part of the NCL code I used:
; read multiple files
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
external OMI "./read_aersl_omi.so" ; fortran shared object produced by WRAPIT
begin
fname = "L3_aersl_omi_20051230.txt"
lat = new(180,float)
lon = new(360,float)
var = new((/180,360/),float)
OMI::read_aersl_omi(fname,lat,lon,var)
print(lat)
print(lon)
print(var)
; ... ... following codes to plot the data
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Oct 03 2009 - 10:12:55 MDT
This archive was generated by hypermail 2.2.0 : Mon Oct 05 2009 - 13:28:34 MDT