<div>Hi there,<br>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!<br>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. <br><br>The fortran code to read the data: (This code is OK to run separately. And it needs a string as filename input)<br>c this program reads the daily gridded data for real-time OMI<br>c data for January 31, 2007. variables lat and lon contain the <br>c latitudes and longitudes of the center of each of the grid <br>c cells in the array AI. <br><br>C NCLFORTSTART<br> subroutine read_aersl_omi(fname,lat,lon,ai)<br> character*80 header <br> integer*4 ai <br> real*4 lat(180), lon(360) <br> character*(*) fname <br> dimension ai(360,180) <br>C NCLEND<br><br>c calculate latitudes and longitudes <br>c <br> dlat = 1.0 <br> do 10 i=1,180 <br> lat(i) = -89.5 + (i-1)*dlat <br>10 continue <br> dlon = 1.0 <br> do 20 i=1,360 <br> lon(i) = -179.5 + (i-1)*dlon <br>20 continue <br>c <br>c open the input file <br>c <br>cc open(1,file='L3_aersl_omi_20051231.txt',status='old') <br> open(1,file=fname,status='old')<br>c <br>c read in the header lines <br>c <br> read(1,'(a80)') header <br> read(1,'(a80)') header <br> read(1,'(a80)') header <br>c <br>c read in the data into the array ozone <br>c <br> do 30 i=1,180 <br> read(1,'(1x,25i3)') (ai(j,i),j=1,360) <br>30 continue <br>c <br>c close the input file <br>c <br> close(1) <br>c <br>c process/print the ai data <br>c write(*,*) ai<br> stop <br> end <br><br>Part of the NCL code I used:<br>; read multiple files<br> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br> external OMI "./read_aersl_omi.so" ; fortran shared object produced by WRAPIT<br> begin<br> fname = "L3_aersl_omi_20051230.txt"<br> lat = new(180,float)<br> lon = new(360,float)<br> var = new((/180,360/),float)<br><br> OMI::read_aersl_omi(fname,lat,lon,var)<br> print(lat)<br> print(lon)<br> print(var)<br>; ... ... following codes to plot the data<br> end<br><br></div><br><br><span title="neteasefooter"/><hr/>
<a href="http://news.163.com/madeinchina/index.html?from=mailfooter">"中国制造",讲述中国60年往事</a>
</span>