Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Fortran Programming Language

Fortran 77/90: creating a table


Hi there,

I have a global dataset (text file) where for every 105 values
(currently
formatted as a continuous string), the 1st represents longitude, the
2nd =
latitude, the 3rd is a 'spinup' value which can be ignored, and the
4th to
105th values are hydrological runoff values for the years 1901 to
2002.

I've been trying to create a table where longitude values are listed
along
the top row (x-axis) and latitude values are listed in the far left
column
(y-axis), with the corresponding runoff values for each year located
in a
given grid - therefore there will be 102 grids created (one for each
year).
The longitude values are currently not ordered and will need to be
sorted
(low to high) into position along the x-axis.

As I am relatively new to Fortran, despite spending a lot of time on
this,
I've been having problems getting off the ground. Therefore I would be
grateful for any help or Fortran (77 or 90) code which will aid my
progress
with this.

Thanks very much,
smurray444

HOW is this file formatted?  Commas between values?  Fixed lengths?
Can you provide a short sample of the file to others or is it
secret or proprietary?

I assume you are cross-posting to openwatcom.users.fortran
becuase you are using or contemplating using OW Fortran.  If
so, limit the code to F77, OW supports some F90 features, but
all of F77.

In a previous article, smurray444 <smurray@gmail.com> wrote:

 If the numbers are in fixed format (i.e. the fields are
the same for each line) - then use fixed format
 e.g. 3f5.1,102f6.2 ... whatever the format happens to be.
The main thing is to get the fields right. An i/p decimal
point will override the format spec.
If data are numbers only and separated by commas (or
maybe spaces)

then (WATCOM FORTRAN77)
 dimension values(105)

c  I'm just guessin 1000 will be more than enough length
  open(  ..., form='formatted',status='old',recl=1000)

10 read( ,*)values

  To order, you have to store all the lines; one possiblity
is:

  PARAMETER(NLINES=999)  !e.g. file has 999 locations
c  assume lines < 1001 chars long

 character*1000 alines(NLINES),bline,cline

  do i=2,NLINES
   do j=1,i-1

   bline=alines(i)
   read(bline,'(...)')blong
   cline=alines(j)
   read(cline,'(...)')clong
  if(blong.lt.clong)then
    alines(i)=cline
    alines(j)=bline
  endif

enddo
enddo
c  then  re-read from alines - which is now in order

   Something like that is what I would do - no black boxes.

Chris

You have described a table with rows and columns.
One of your stated problems (order) is solved by interchanging columns
until they are in the desired order.
You have another problem in that your data seems to be text values (3
coordinates and 102 point mearures) in a record of text strings.
.
Ordering the data is the easy part.
Formatting the data by data type or some commonly used separator is
the main problem.
As stated, a single data line example (even the left part) given here
will get you plenty of good advice from the Forum.
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc