Skip to content

Instantly share code, notes, and snippets.

@wjcapehart
Created September 13, 2018 19:19
Show Gist options
  • Save wjcapehart/1cedeebe3106758f77659709fa08c1ad to your computer and use it in GitHub Desktop.
Save wjcapehart/1cedeebe3106758f77659709fa08c1ad to your computer and use it in GitHub Desktop.
program read_unidata
implicit none
character (len=180) :: directory
character (len=180) :: filename
character (len= 4) :: station_code
integer :: yyyy
integer :: mm
integer :: dd
integer :: hh
integer :: mn
real :: longitude
real :: latitude
real :: elevation
real :: tmpf
real :: dwpf
real :: drct
real :: sknt
real :: pmsl
integer :: ios
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
directory = "/academic/atm_519/data/UNIDATA_ASCII_2014/"
filename = "sflist_2014-10-01.txt"
open(unit = 1, &
file = trim(directory) // trim(filename), &
status = "old", &
form = "formatted", &
iostat = ios)
print*, ios
!reading headers
read(1,*)
read(1,*)
read(1,*)
read(1,*)
! read station line
read(1,*) station_code
print*, station_code
!
!--- Sample Read Line From Unidata SFLIST Command
!
!12312341234121212112121123456789123456789123456789123456789123456789123456789
! STN YYMMDD/HHMM SLON SLAT SELV TMPF DWPF DRCT
!12345678901234567890123123456789123456789
! SKNT PMSL
! 2G4 141001/0000 -79.34 39.58 894.00 51.80 -9999.00 210.00
! 4.00 -9999.00
close(unit = 1)
end program read_unidata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment