0

I am using Fortran Powerstation 4.0 and I am trying to read a file with the following structure:

Aarhus, Denmark                                  OVPID: 034   Latitude:   56.170 deg.      Longitude:   10.200 deg.     Altitude:      53 m
 
Value 1 (year) : Year
Value 2 (mon)  : Month
Value 3 (day)  : Day
Value 4 (doy)  : Day of Year
Value 5 (time) : Seconds after UTC midnight (s)
Value 6 (dist) : Distance to station (km)
Value 7 (#pts) : Number of points used in overpass
Value 8 (sza)  : Solar zenith angle (deg.)
Value 9 (ptoz) : Profile total ozone (DU)
Value 10-30    : Layer ozone amount (DU) for 21 layers
Layer Bottom Pressure (hPa) 1013.25 639.3 403.4 254.5 160.6 101.3 63.9 40.3 25.5 16.1 10.1 6.39 4.03 2.55 1.61 1.01 0.639 0.403 0.254 0.161 0.101

year mon day doy   time    dist #pts   sza    ptoz     L1     L2     L3     L4     L5     L6     L7     L8     L9    L10    L11    L12    L13    L14    L15     L16     L17     L18     L19     L20     L21
2012  02  02  33  43035    95.7    1  73.1   300.3  11.35   8.32  10.32  22.86  37.13  42.06  42.64  36.56  27.90  20.66  15.21  10.86   7.05   3.97   1.95   0.862   0.363   0.150   0.062   0.025   0.017
2012  02  03  34  41898   191.0    1  73.0   338.3  11.76   8.90  11.35  26.04  43.78  50.92  51.68  42.41  30.01  20.84  15.06  11.03   7.25   3.93   1.86   0.841   0.369   0.155   0.064   0.026   0.018

When running:

      program project
      integer year, mon, day, doy, time
      open(1,file='C:\test.txt')
      read(1,1000, end=35) year, mon, day, doy, time
      close(1)
  35  continue
1000  format(i4, 1x, i3, 1x, i2, 1x, i5)
1001  format(i4)    
      end

I get the following error:

run-time error F6101: READ(C:\test.txt)
- invalid INTEGER

I found out that this error is due to the 15 first lines of the file, since when I erase them from the file my code runs smoothly. I was wondering how I can skip reading the first 15 lines of the test file without having to mess with the file itself. I am looking for something like the skiprow parameter used in python.

chadoulis
  • 383
  • 1
  • 3
  • 15
  • 1
    Are it always 15 lines? If so you could probably do `read(1,*)` for the first 15 lines. – albert Feb 07 '22 at 08:54
  • It's always 15. It would be really helpful if you could formulate and provide the full answer. Thanks in advance. – chadoulis Feb 07 '22 at 09:01
  • You probably know that, but MS Powerstation is really obsolete and abandoned and contains old bugs. You just need to do `read(1,*)` 15 times. You can use a loop for that. – Vladimir F Героям слава Feb 07 '22 at 09:15
  • I didn't know about the old bugs, but your statement sounds reasonable. I had no intention of using MS Powerstation. I only use it because a professor at the University asked us to use it for an assignment. If you could provide a link that elaborates on the arguments against using MS Powerstation today, I would really appreciate it. – chadoulis Feb 07 '22 at 09:21
  • 1
    I do not have any comprehensive overview but see the history remarks at https://fortran-lang.discourse.group/t/intel-releases-oneapi-toolkit-free-fortran-2018/471/14 Microsoft discontinued Powerstation in the 1990s. – Vladimir F Героям слава Feb 07 '22 at 09:28

0 Answers0