示例#1
0
def run(table_type):
    """
    For each entry in validation table, compute sTEC
    Validation run takes a few minutes to complete so results are saved to file.
    :param table_type: (str)
    :return:
    """
    print "Validating against", table_type, "Solar Activity data table"

    # Hard coded solar indices
    if table_type == "High":
        BX = GalileoBroadcast(236.831641, -0.39362878, 0.00402826613)
    elif table_type == "Medium":
        BX = GalileoBroadcast(121.129893, 0.351254133, 0.0134635348)
    elif table_type == "Low":
        BX = GalileoBroadcast(2.580271, 0.127628236, 0.0252748384)
    else:
        raise ValueError(
            'table_type argument must be either "High", "Medium" or "Low"')

    # output variables
    sTECs_expected = []
    sTECs_computed = []

    with open(os.path.join('Validation',
                           table_type + '_reference.dat')) as infile:
        with file(os.path.join('Validation', table_type + '_output.dat'),
                  'w') as outfile:
            writer = csv.writer(outfile, delimiter=' ')
            reader = csv.reader(infile, delimiter=' ')
            for row in reader:
                row = map(float, row)

                mth = int(row[0])
                UT = int(row[1])

                lon1 = row[2]
                lat1 = row[3]
                h1 = row[4] / 1000  # change m to km

                lon2 = row[5]
                lat2 = row[6]
                h2 = row[7] / 1000  # change m to km

                time = NEQTime(mth, UT)
                NEQ_global = NequickG_global(time, BX)
                ray = Ray(h1, lat1, lon1, h2, lat2, lon2)
                stec = NEQ_global.sTEC(ray) / 10**16

                sTECs_computed.append(stec)
                sTECs_expected.append(row[8])
                row.append(stec)

                writer.writerow(row)

                print "Input: ", row[:7]
                print "---Expected: ", row[8], "---Obtained: ", row[9]
    return sTECs_expected, sTECs_computed
示例#2
0
import matplotlib.pyplot as plt
import numpy as np
from NequickG import NEQTime, Position, GalileoBroadcast
from NequickG_global import NequickG_global


""" Input Parameters here """
mth = 4
UT = 12
lat = 40
lon = 100
Az = 64

""" Processing Below """
# Create input objects
TX = NEQTime(mth,UT)
BX = GalileoBroadcast(Az,0,0)
RX = Position(lat,lon)

# Create Nequick models
NEQ_global = NequickG_global(TX,BX)
NEQ, Para = NEQ_global.get_Nequick_local(RX)

# Extract information from model
hmin = 100
hmax = 1000
hs = np.arange(hmin, hmax)
N = NEQ.electrondensity(hs)
Azr = Para.Azr

# Plotting
示例#3
0
"""This task demonstrates how to obtain vertical total electron count
and the ratio of total electrons in bottomside to that in topside"""

from NequickG import NEQTime, Position, GalileoBroadcast
from NequickG_global import NequickG_global

# Input objects
TX = NEQTime(4, 12)
RX = Position(40, 0)
BX = GalileoBroadcast(236.831, 0, 0)

# Nequick objects
NEQ_global = NequickG_global(TX, BX)
NEQ, Para = NEQ_global.get_Nequick_local(RX)

# vTEC quantities of interest
print(NEQ.vTEC(100, 2000))
print(NEQ.vTEC_ratio())
示例#4
0
"""This task demonstrates how to compute slant total electron count"""
from NequickG import NEQTime, Position, GalileoBroadcast
from NequickG_global import NequickG_global, Ray

# Input objects
TX = NEQTime(10,12)
BX = GalileoBroadcast(80,0,0)

# Nequick objects
NEQ_global = NequickG_global(TX, BX)
ray = Ray(100,40,0,1000,40,0)

print NEQ_global.sTEC(ray)
print NEQ_global.sTEC2(ray)

NEQ_global.slant_table(91,ray, 'slant_ray.dat', ex_attr=['foF1', 'foF2', 'foE'])

示例#5
0
        cs = mapp.contourf(xx, yy, outs[i])

        plt.title(attrs[i])
        mapp.colorbar(cs)

        if not os.path.exists(path):
            os.makedirs(path)

        plt.savefig(os.path.join(path, attrs[i] + '.png'))
        plt.close()


# plot parameters for Validation test scenarios
solar = 'Medium'  # or 'Medium' or 'Low'

if solar == 'Low':
    BX = GalileoBroadcast(2.580271, 0.127628236,
                          0.0252748384)  # Low solar activity
elif solar == 'Medium':
    BX = GalileoBroadcast(121.129893, 0.351254133,
                          0.0134635348)  # Medium solar activity
elif solar == 'High':
    BX = GalileoBroadcast(236.831641, -0.39362878,
                          0.00402826613)  # High solar activity
else:
    raise ValueError

for time in [0, 4, 8, 12, 16, 20]:
    TX = NEQTime(4, time)
    plotparameters(TX, BX, os.path.join('maps', solar, str(time)))
示例#6
0
    if not os.path.exists('foF2/' + str(mth) + '/'):
        os.makedirs('foF2/' + str(mth) + '/')
    if not os.path.exists('M3000F2/' + str(mth) + '/'):
        os.makedirs('M3000F2/' + str(mth) + '/')

    for UT in range(0,23):

        foF2map_high = np.ones([res, res], dtype=np.float32)
        foF2map_low = np.ones([res, res], dtype=np.float32)
        M3000map_low = np.ones([res, res], dtype=np.float32)
        M3000map_high = np.ones([res, res], dtype=np.float32)

        for i in range(res):
            for j in range(res):
                lat = latlat[j, i]
                lon = lonlon[j, i]
                pos = Position(lat, lon)
                time = NEQTime(mth, UT)
                ccir = CCIR_Unpacker(pos, time)
                foF2map_low[j, i], M3000map_low[j, i] = ccir.compute('low')
                foF2map_high[j, i], M3000map_high[j, i] = ccir.compute('high')

        path = os.path.join('foF2', str(mth), "high" + '{:02d}'.format(UT) + '.png')
        plotmap(lonlon, latlat, foF2map_high, 'foF2map: mth= ' + str(mth) + " UT=" + str(UT),path)
        path = os.path.join('foF2', str(mth), "low" + '{:02d}'.format(UT) + '.png')
        plotmap(lonlon, latlat, foF2map_low, 'foF2map: mth= ' + str(mth) + " UT=" + str(UT), path)
        path = os.path.join('M3000F2', str(mth), 'high' + '{:02d}'.format(UT) + '.png')
        plotmap(lonlon, latlat, M3000map_high, 'M3000F2map: mth= ' + str(mth) + " UT=" + str(UT),path)
        path = os.path.join('M3000F2', str(mth), 'low' + '{:02d}'.format(UT) + '.png')
        plotmap(lonlon, latlat, M3000map_low, 'M3000F2map: mth=' + str(mth) + " UT=" + str(UT), path)