[OpenMadrigal-developers] Re: fof2 readings
William Rideout
brideout at haystack.mit.edu
Fri Oct 31 15:24:08 EST 2003
Glenn,
I've attached a python script that converts the NOAA file into our fof2
file format, similar to the one you create by hand. To run it:
convertNoaaFof2.py <noaa filename> <new filename>
This should allow you to download these files off the net, and easily
covert them to our fof2 file format.
Note, however, that I don't know if they archive old copies of these files.
This file is in CVS under Millstone/Madrigal/Procedures.
Bill
Glenn Campbell wrote:
> Bill,
>
> Here is the location for online f0f2 reading:
>
> http://sec.noaa.gov/ftpdir/lists/iono_day/Millstone_Hill_iono.txt
>
> If a fof2 is listed as -1.0 it is bogus and indicates the e-region could
> not be valued. This relates to a 0.0 value I would normally put into
> the edited file.
>
> The format I use before updating the database is as follows:
>
> 09/25/2003 14.000 6.05
>
> mm/dd/yyyy hh.mins fof2 (minutes are either 000 or 500 meaning
> on the hour or the half hour.
>
> Thanks,
> Glenn
>
>
--
Bill Rideout
MIT Haystack Observatory
Email: brideout at haystack.mit.edu
Phone: 781 981-5624
-------------- next part --------------
#!/usr/bin/env python
""" convertNoaaFof2.py converts an Fof2 file as found on the website:
http://sec.noaa.gov/ftpdir/lists/iono_day/
to standard text form for loading into Madrigal.
Example from NOAA:
# UT Date Time
# YR MO DA HHMM foF2 hmF2 M(D) D h'F yF2 fMUF h' fxI foF1 foE hmE foEs fbEs ITEC
#-------------------------------------------------------------------------------------------
2003 10 30 0000 -1.0 -1 -1.00 3000 -1 -1 -1.0 -1 -1.0 -1.0 -1.0 -1 6.5 -1.0 -1.0
2003 10 30 0015 -1.0 -1 -1.00 3000 -1 -1 -1.0 -1 -1.0 -1.0 -1.0 -1 -1.0 -1.0 -1.0
2003 10 30 0030 -1.0 -1 -1.00 3000 -1 -1 -1.0 -1 -1.0 -1.0 -1.0 -1 4.6 -1.0 -1.0
Example test form:
09/25/2003 14.000 6.05
Usage: convertNoaaFof2.py <noaa file> <output filename>
Written by Bill Rideout 10/31/2003
"""
usageStr = 'Usage: convertNoaaFof2.py <noaa file> <output filename>'
import sys
import os
import string
import time
import traceback
args = sys.argv[1:]
if len(args) != 2:
print usageStr
sys.exit(-1)
noaaFilename = args[0]
newFilename = args[1]
# try to open the two files
noaaFile = open(noaaFilename, 'r')
newFile = open(newFilename, 'w')
lines = noaaFile.readlines()
for line in lines:
if line[0] in ('#', ':', ' '):
continue
if len(string.strip(line)) == 0:
continue
items = string.split(line)
# try to parse
try:
year = int(items[0])
month = int(items[1])
day = int(items[2])
HHMM = int(items[3])
fof2 = float(items[4])
# convert HHMM to float hours
hours = HHMM/100
minutes = HHMM - hours*100
floatHours = float(hours) + float(minutes/60.0)
# skip negative fof2
if fof2 < 0.5:
continue
newline = '%s/%s/%s %5.3f %6.3f\n' % (month,day,year,floatHours,fof2)
newFile.write(newline)
except:
noaaFile.close()
newFile.close()
traceback.print_exc()
print 'Illegal line found: %s' % (line)
sys.exit(-1)
print 'Conversion complete'
noaaFile.close()
newFile.close()
More information about the OpenMadrigal-developers
mailing list