예제 #1
0
def run_IRI16_func(dataframe, no_rows, no_columns):
    print('models started...')
    for i in range(no_rows):
#         print("run line  ", i, " of lines ", no_rows)

        pt = pyglow.Point(dataframe[i].datetime, float(dataframe[i].g_lat), float(dataframe[i].g_long),
                          float(dataframe[i].alt))
        # run iri2016...
        pt.run_iri()

        if (dataframe[i].alt <= max_IRI16_alt) & (dataframe[i].alt >= min_IRI16_alt):
            variable_classes.Outputs["ne_iri16"].append(pt.ne)  # iri2016_output[0]=Ne
            variable_classes.Outputs["Te_iri16"].append(pt.Te)  # iri2016_output[1]=Te
            variable_classes.Outputs["Ti_iri16"].append(pt.Ti)  # iri2016_output[2]=Ti

            # .nn list contains 'NO+', 'H+', 'O2+', 'HE+', 'O+' from iri model
            variable_classes.Outputs["Oplus_iri16"].append(pt.ni['O+'])  # iri2016_output[3]=Oplus
        else:
            variable_classes.Outputs["ne_iri16"].append(None)  # iri2016_output[0]=Ne
            variable_classes.Outputs["Te_iri16"].append(None)  # iri2016_output[1]=Te
            variable_classes.Outputs["Ti_iri16"].append(None)  # iri2016_output[2]=Ti

            # .nn list contains 'NO+', 'H+', 'O2+', 'HE+', 'O+' from iri model
            variable_classes.Outputs["Oplus_iri16"].append(None)  # iri2016_output[3]=Oplus
        if (dataframe[i].alt <= min_IRI116_NOplus_O2plus) & (dataframe[i].alt >= min_IRI16_alt):
            variable_classes.Outputs["O2plus_iri16"].append(pt.ni['O2+'])  # iri2016_output[4]=O2_plus
            variable_classes.Outputs["NOplus_iri16"].append(pt.ni['NO+'])  # iri2016_output[5]=NO_plus
        else:
            variable_classes.Outputs["O2plus_iri16"].append(None)  # iri2016_output[4]=O2_plus
            variable_classes.Outputs["NOplus_iri16"].append(None)  # iri2016_output[5]=NO_plus
    print('IRI16 finished')
    return
예제 #2
0
    def setUp(self):

        dn = datetime(2017, 3, 23, 12)
        lat = 40
        lon = -88
        alt = 250
        self.pt = pyglow.Point(dn, lat, lon, alt)
예제 #3
0
def run_HWM14_func(dataframe, no_rows, no_columns):
    print('models started...')
    for i in range(no_rows):
        #print("run line  ", i, " of lines ", no_rows)

        pt = pyglow.Point(dataframe[i].datetime, float(dataframe[i].g_lat),
                          float(dataframe[i].g_long), float(dataframe[i].alt))
        pt.run_hwm()
        if (dataframe[i].alt <= max_HWM14_alt) & (dataframe[i].alt >=
                                                  min_HWM14_alt):
            variable_classes.Outputs["v_hwm14"].append(
                pt.v)  # meridional wind (northward) to output table
            variable_classes.Outputs["u_hwm14"].append(
                pt.u)  # zonal wind (eastward) to output table
        else:
            variable_classes.Outputs["v_hwm14"].append(None)
            variable_classes.Outputs["u_hwm14"].append(None)

    print('HWM14 finished')
    return
예제 #4
0
def run_MSISE00_func(dataframe, no_rows, no_columns):
    print('models started...')
    for i in range(no_rows):
        #print("run line  ", i, " of lines ", no_rows)

        pt = pyglow.Point(dataframe[i].datetime, float(dataframe[i].g_lat),
                          float(dataframe[i].g_long), float(dataframe[i].alt))
        # run iri2016...
        pt.run_msis()

        if (dataframe[i].alt <= max_MSISE00_alt) & (dataframe[i].alt >=
                                                    min_MSISE00_alt):
            variable_classes.Outputs["Tn_msise00"].append(
                pt.Tn_msis)  # msise00_output[0]=Tn
            variable_classes.Outputs["O_msise00"].append(
                pt.nn['O'])  # msise00_output[1]=O
            variable_classes.Outputs["O2_msise00"].append(
                pt.nn['O2'])  # msise00_output[2]=O2
            variable_classes.Outputs["N2_msise00"].append(
                pt.nn['N2'])  # msise00_output[3]=O2
            variable_classes.Outputs["rho_msise00"].append(
                pt.rho
            )  # msise00_output[4]=Dn (Density) total mass density rho [grams/cm^3]
        else:
            variable_classes.Outputs["Tn_msise00"].append(
                None)  # msise00_output[0]=Tn
            variable_classes.Outputs["O_msise00"].append(
                None)  # msise00_output[1]=O
            variable_classes.Outputs["O2_msise00"].append(
                None)  # msise00_output[2]=O2
            variable_classes.Outputs["N2_msise00"].append(
                None)  # msise00_output[3]=O2
            variable_classes.Outputs["rho_msise00"].append(
                None
            )  # msise00_output[4]=Dn (Density) total mass density rho [grams/cm^3]

    print('MSISE finished')
    return
from datetime import datetime

import pyglow

terminate = 0
while not terminate:
    year = input()
    month = input()
    day = input()
    hour = input()
    minute = input()
    latitude = input()
    longitude = input()
    altitude = input()
    terminate = int(input())

    time = datetime(int(year), int(month), int(day), int(hour), int(minute))

    pt = pyglow.Point(time, float(latitude), float(longitude), float(altitude))
    pt.run_iri()

    print(pt.ne, flush=True)

    if terminate:
        break
예제 #6
0
matplotlib.rcParams.update({'font.size': 16})

# Setting lat, lon, and a range of altitudes
lat = 18.37  # Arecibo
lon = -66.62
alts = np.linspace(85, 1000, 500)

# Set time (i.e., dn)
dn_lt = datetime(2012, 3, 22, 0, 0)
tz = np.ceil(lon / 15.)
dn_ut = dn_lt - timedelta(hours=tz)

# Airglow calculation using pyglow:
ag, ne = [], []
for alt in alts:
    pt = pyglow.Point(dn_ut, lat, lon, alt)

    pt.run_iri()
    pt.run_msis()
    pt.run_airglow()

    ag.append(pt.ag6300)
    ne.append(pt.ne)

# Plot data:
plt.figure(1, figsize=(7, 8))
plt.clf()
plt.semilogy(ag, alts, '-k', lw=4, label='$V_{630.0}$')
plt.grid()
plt.ylim([alts[0], alts[-1]])
the_yticks = np.arange(100, 1001, 100)
예제 #7
0
def add_hwm_winds_and_ecef_vectors(inst,
                                   glat_label='glat',
                                   glong_label='glong',
                                   alt_label='alt'):
    """ 
    Uses HWM (Horizontal Wind Model) model to obtain neutral wind details.
    
    Uses pyglow module to run HWM. Configured to use actual solar parameters to run 
    model.
    
    Example
    -------
        # function added velow modifies the inst object upon every inst.load call
        inst.custom.add(add_hwm_winds_and_ecef_vectors, 'modify', glat_label='custom_label')
    
    Parameters
    ----------
    inst : pysat.Instrument
        Designed with pysat_sgp4 in mind
    glat_label : string
        label used in inst to identify WGS84 geodetic latitude (degrees)
    glong_label : string
        label used in inst to identify WGS84 geodetic longitude (degrees)
    alt_label : string
        label used in inst to identify WGS84 geodetic altitude (km, height above surface)
        
    Returns
    -------
    inst
        Input pysat.Instrument object modified to include HWM winds.
        'zonal_wind' for the east/west winds (u in model) in m/s
        'meiridional_wind' for the north/south winds (v in model) in m/s
        'unit_zonal_wind_ecef_*' (*=x,y,z) is the zonal vector expressed in the ECEF basis
        'unit_mer_wind_ecef_*' (*=x,y,z) is the meridional vector expressed in the ECEF basis
        'sim_inst_wind_*' (*=x,y,z) is the projection of the total wind vector onto s/c basis
        
    """

    import pyglow
    import pysatMagVect

    hwm_params = []
    for time, lat, lon, alt in zip(inst.data.index, inst[glat_label],
                                   inst[glong_label], inst[alt_label]):
        # Point class is instantiated.
        # Its parameters are a function of time and spatial location
        pt = pyglow.Point(time, lat, lon, alt)
        pt.run_hwm()
        hwm = {}
        hwm['zonal_wind'] = pt.u
        hwm['meridional_wind'] = pt.v
        hwm_params.append(hwm)
    # print 'Complete.'
    hwm = pds.DataFrame(hwm_params)
    hwm.index = inst.data.index
    inst[['zonal_wind',
          'meridional_wind']] = hwm[['zonal_wind', 'meridional_wind']]

    # calculate zonal unit vector in ECEF
    # zonal wind: east - west; positive east
    # EW direction is tangent to XY location of S/C in ECEF coordinates
    mag = np.sqrt(inst['position_ecef_x']**2 + inst['position_ecef_y']**2)
    inst['unit_zonal_wind_ecef_x'] = -inst['position_ecef_y'] / mag
    inst['unit_zonal_wind_ecef_y'] = inst['position_ecef_x'] / mag
    inst['unit_zonal_wind_ecef_z'] = 0 * inst['position_ecef_x']

    # calculate meridional unit vector in ECEF
    # meridional wind: north - south; positive north
    # mer direction completes RHS of position and zonal vector
    unit_pos_x, unit_pos_y, unit_pos_z = \
        pysatMagVect.normalize_vector(-inst['position_ecef_x'], -inst['position_ecef_y'], -inst['position_ecef_z'])

    # mer = r x zonal
    inst['unit_mer_wind_ecef_x'], inst['unit_mer_wind_ecef_y'], inst['unit_mer_wind_ecef_z'] = \
        pysatMagVect.cross_product(unit_pos_x, unit_pos_y, unit_pos_z,
                                   inst['unit_zonal_wind_ecef_x'], inst['unit_zonal_wind_ecef_y'], inst['unit_zonal_wind_ecef_z'])

    # Adding metadata information
    inst.meta['zonal_wind'] = {
        'units': 'm/s',
        'long_name': 'Zonal Wind',
        'desc': 'HWM model zonal wind'
    }
    inst.meta['meridional_wind'] = {
        'units': 'm/s',
        'long_name': 'Meridional Wind',
        'desc': 'HWM model meridional wind'
    }
    inst.meta['unit_zonal_wind_ecef_x'] = {
        'units': '',
        'long_name': 'Zonal Wind Unit ECEF x-vector',
        'desc': 'x-value of zonal wind unit vector in ECEF co ordinates'
    }
    inst.meta['unit_zonal_wind_ecef_y'] = {
        'units': '',
        'long_name': 'Zonal Wind Unit ECEF y-vector',
        'desc': 'y-value of zonal wind unit vector in ECEF co ordinates'
    }
    inst.meta['unit_zonal_wind_ecef_z'] = {
        'units': '',
        'long_name': 'Zonal Wind Unit ECEF z-vector',
        'desc': 'z-value of zonal wind unit vector in ECEF co ordinates'
    }
    inst.meta['unit_mer_wind_ecef_x'] = {
        'units': '',
        'long_name': 'Meridional Wind Unit ECEF x-vector',
        'desc': 'x-value of meridional wind unit vector in ECEF co ordinates'
    }
    inst.meta['unit_mer_wind_ecef_y'] = {
        'units': '',
        'long_name': 'Meridional Wind Unit ECEF y-vector',
        'desc': 'y-value of meridional wind unit vector in ECEF co ordinates'
    }
    inst.meta['unit_mer_wind_ecef_z'] = {
        'units': '',
        'long_name': 'Meridional Wind Unit ECEF z-vector',
        'desc': 'z-value of meridional wind unit vector in ECEF co ordinates'
    }
    return
예제 #8
0
def PROC_StatsCalculator(ProcessNum, CDF_filename, TypeOfCalculation):
    # partialResultFilename IS OBSOLETE, TMP_FOLDER is used to save all values
    #partialResultFilename = Data.ResultFilename+".part"+str(ProcessNum)
    #if os.path.exists(partialResultFilename):
    #    print( "Process",ProcessNum, ":", partialResultFilename, "exists. I am not needed." )
    #    return # <<<<

    # check if the data of this process have already been calculated
    procfolder = TMP_FOLDER + "proc" + f"{ProcessNum:03}" + "/"
    if os.path.isdir(procfolder):
        print("Data for file", ProcessNum, "already calculated.", "Process",
              ProcessNum, "finished.")
        return  # <<<<
    else:
        if os.path.isdir(TMP_FOLDER) == False: os.mkdir(TMP_FOLDER)
        os.mkdir(procfolder)

    # open netCDF file
    ######## while( os.path.exists("ReadingFile.flag") ): # wait until no other process is reading from disk/NFS
    ########    time.sleep(random.randint(8,20))
    print("Process", ProcessNum, "reading ",
          CDF_filename[CDF_filename.rfind('/') + 1:],
          datetime.datetime.now().strftime("%d-%m-%Y %H:%M:%S"))
    #Path("ReadingFile.flag").touch() # raise a flag that this process is now reading a file, so that other processes wait
    try:
        CDFroot = Dataset(CDF_filename, 'r')
    except:
        print(" !!!!!!!! WRONG FORMAT:", CDF_filename)
        #os.remove("ReadingFile.flag") # lower the reading-file flag
        return

    # read the data from the netCDF file
    #TIMEs  = CDFroot.variables['time'][:]
    if "JH" in TypeOfCalculation:
        Ohmics = CDFroot.variables['Ohmic'][:, :, :, :]  # m/s
    if "PedCond" in TypeOfCalculation:
        PEDs = CDFroot.variables['SIGMA_PED'][:, :, :, :]
    if "HallCond" in TypeOfCalculation:
        HALs = CDFroot.variables['SIGMA_HAL'][:, :, :, :]
    if "EEX_si" in TypeOfCalculation:
        EEXs = CDFroot.variables['EEX_si'][:, :, :, :]
    if "EEY_si" in TypeOfCalculation:
        EEYs = CDFroot.variables['EEY_si'][:, :, :, :]
    if "ConvHeat" in TypeOfCalculation:
        ConvH = CDFroot.variables['Convection_heating'][:, :, :, :]
    if "WindHeat" in TypeOfCalculation:
        WindH = CDFroot.variables['Wind_heating'][:, :, :, :]
    if "JHminusWindHeat" in TypeOfCalculation:
        WindH = CDFroot.variables['Wind_heating'][:, :, :, :]

    if "JHnoWindsEISCAT" in TypeOfCalculation:
        UI = CDFroot.variables['UI_ExB'][:, :, :, :]
        VI = CDFroot.variables['VI_ExB'][:, :, :, :]
        WI = CDFroot.variables['WI_ExB'][:, :, :, :]
        TIMEs = CDFroot.variables['time'][:]
        PEDs = CDFroot.variables['SIGMA_PED'][:, :, :, :]
        LONs = CDFroot.variables['lon'][:]
        ZGs = CDFroot.variables[
            'ZG'][:, :, :, :] / 100000  # Geometric height stored in cm, converted to km
    #
    if "EISCAT" in TypeOfCalculation:
        LATs = CDFroot.variables['lat'][:]
    MLATs = CDFroot.variables['mlat_qdf'][:, :, :, :]
    MLTs = CDFroot.variables['mlt_qdf'][:, :, :, :]
    ALTs = CDFroot.variables[
        'ZGMID'][:, :, :, :] / 100000  # Geometric height stored in cm, converted to km
    KPs = CDFroot.variables['Kp'][:]

    #try:
    #    os.remove("ReadingFile.flag") # lower the reading-file flag
    #except:
    #    pass

    ResultBuckets = Data.init_ResultDataStructure().copy()
    num_of_unbinned_items = 0
    step = 1
    for idx_time in range(0, len(ALTs), step):
        if idx_time % 20 == 0:
            print(
                idx_time, "of", len(ALTs),
                CDF_filename[CDF_filename.rfind("sech_") +
                             4:CDF_filename.rfind("_JH") + 1] + "...nc",
                datetime.datetime.now().strftime("%H:%M:%S"))
        for idx_lev in range(0, len(ALTs[0]), step):
            for idx_lat in range(0, len(ALTs[0, 0]), step):
                for idx_lon in range(0, len(ALTs[0, 0, 0]), step):

                    curr_alt_km = ALTs[idx_time, idx_lev, idx_lat, idx_lon]

                    # ignore values for out-of-range positions
                    if curr_alt_km < Data.ALT_min or curr_alt_km > Data.ALT_max:
                        continue
                    if "EISCAT" in TypeOfCalculation:
                        if LATs[idx_lat] < 71 or LATs[
                                idx_lat] > 78.5:  #if LATs[idx_lat] < 60:
                            continue

                    curr_kp = KPs[idx_time]
                    curr_mlt = MLTs[idx_time, idx_lev, idx_lat, idx_lon]
                    curr_maglat = MLATs[idx_time, idx_lev, idx_lat, idx_lon]

                    kp_to_fall, alt_to_fall, maglat_to_fall, mlt_to_fall = Data.LocatePositionInBuckets(
                        curr_kp, curr_alt_km, curr_maglat, curr_mlt)

                    if kp_to_fall is None or alt_to_fall is None or maglat_to_fall is None or mlt_to_fall is None:
                        num_of_unbinned_items += 1
                        #if num_of_unbinned_items < 4:
                        #    print( "WARNING: [", curr_kp, curr_alt_km, curr_maglat, curr_mlt, "] -> [", kp_to_fall, alt_to_fall, maglat_to_fall, mlt_to_fall, "] not binned" )
                        break
                    else:
                        if TypeOfCalculation == "JHminusWindHeat" or TypeOfCalculation == "JHminusWindHeatEISCAT":
                            aValue = Ohmics[idx_time, idx_lev, idx_lat,
                                            idx_lon] - WindH[idx_time, idx_lev,
                                                             idx_lat, idx_lon]
                            if aValue > 100:
                                continue  # ignore faulty large values
                        elif TypeOfCalculation == "JHEISCAT" or TypeOfCalculation == "JH":
                            aValue = Ohmics[idx_time, idx_lev, idx_lat,
                                            idx_lon]
                            if aValue > 100:
                                continue  # ignore faulty large values
                        elif "PedCond" in TypeOfCalculation:
                            aValue = PEDs[idx_time, idx_lev, idx_lat, idx_lon]
                        elif "HallCond" in TypeOfCalculation:
                            aValue = HALs[idx_time, idx_lev, idx_lat, idx_lon]
                        elif "EEX_si" in TypeOfCalculation:
                            aValue = EEXs[idx_time, idx_lev, idx_lat, idx_lon]
                        elif "EEY_si" in TypeOfCalculation:
                            aValue = EEYs[idx_time, idx_lev, idx_lat, idx_lon]
                        elif "ConvHeat" in TypeOfCalculation:
                            aValue = ConvH[idx_time, idx_lev, idx_lat, idx_lon]
                            if aValue > 100:
                                continue  # ignore faulty large values
                        elif "WindHeat" in TypeOfCalculation:
                            aValue = WindH[idx_time, idx_lev, idx_lat, idx_lon]
                        elif TypeOfCalculation == "JHnoWindsEISCAT":
                            I = list()
                            B = list()
                            time_p = datetime.datetime(
                                2015, 3, 15, 0, 0, 0) + datetime.timedelta(
                                    minutes=TIMEs[idx_time])
                            lat_p = LATs[idx_lat]
                            lon_p = LONs[idx_lon]
                            alt_p = ZGs[idx_time, idx_lev, idx_lat, idx_lon]
                            pt = pyglow.Point(time_p, lat_p, lon_p,
                                              alt_p)  # pyglow igrf
                            pt.run_igrf()
                            B.append(pt.Bx)  # Be, Tesla  (si)
                            B.append(pt.By)  # Bn, Tesla  (si)
                            B.append(pt.Bz)  # Bu, Tesla  (si)
                            I.append(UI[idx_time, idx_lev, idx_lat, idx_lon])
                            I.append(VI[idx_time, idx_lev, idx_lat, idx_lon])
                            I.append(WI[idx_time, idx_lev, idx_lat, idx_lon])
                            E = -1 * np.cross(I, B)
                            aValue = PEDs[idx_time, idx_lev, idx_lat,
                                          idx_lon] * np.dot(E, E)
                        else:
                            print("ERROR: UNRECOGNISED TypeOfCalculation '" +
                                  TypeOfCalculation + "'")
                            CDFroot.close()
                            return

                        ResultBuckets[kp_to_fall, alt_to_fall, maglat_to_fall,
                                      mlt_to_fall, "Vals"].append(aValue)

    # close cdf
    print("Process", ProcessNum, "num_of_unbinned_items =",
          num_of_unbinned_items)
    CDFroot.close()

    # save results
    #XML.WriteResultsToXML( ResultBuckets, "Ohmic", ResultFilename + ".part" + str(ProcessNum), CDF_filename )
    #Data.WriteResultsToCDF(ResultBuckets, partialResultFilename, "Joule Heating", "W/m3")

    # ---- save values of each bin in a txt file
    print("A", datetime.datetime.now().strftime("%d-%m-%Y %H:%M:%S"))
    for aKP in Data.KPsequence:
        for anALT in Data.ALTsequence:
            for aMagLat in Data.MLATsequence:
                for aMLT in Data.MLTsequence:
                    if len(ResultBuckets[aKP, anALT, aMagLat, aMLT,
                                         "Vals"]) > 0:
                        fname = str(aKP) + "_" + str(anALT) + "_" + str(
                            aMagLat) + "_" + str(aMLT) + ".txt"
                        # FOR WRITING VALUES AS TEXT:
                        #    f = open( procfolder + fname, "w" )
                        #    f.write( ' '.join([str(i) for i in ResultBuckets[aKP, anALT, aMagLat, aMLT, "Vals"]]) )
                        f = open(procfolder + fname, "wb")
                        float_array = array(
                            'd', ResultBuckets[aKP, anALT, aMagLat, aMLT,
                                               "Vals"])
                        float_array.tofile(f)
                        f.close()

    # ----
    print("Process", ProcessNum, "concluded.")
예제 #9
0
    limb=limb,
    Spherical=Spherical,
    reg_method=reg_method,
    regu_order=regu_order,
    contribution=contribution,
    dn=dn,
    f107=my_f107,
    f107a=my_f107a,
    f107p=my_f107p,
    apmsis=my_apmsis)

ne_true = np.zeros_like(Ne)
for m in range(len(ne_true)):
    pt = pyglow.Point(dn,
                      satlatlonalt[0],
                      satlatlonalt[1],
                      h_centered[m],
                      user_ind=True)
    # pt = pyglow.Point(dn, tanlats[m], tanlons[m], h_centered[m], user_ind=True)
    pt.f107 = my_f107
    pt.f107a = my_f107a
    pt.f107p = my_f107p
    pt.apmsis = my_apmsis
    pt.run_iri()
    ne_true[m] = pt.ne

hm, Nm, sig_hm, sig_Nm = find_hm_Nm_F2(Ne, h_centered, Sig_NE=Sig_Ne)
hm_w, Nm_w, sig_hm_w, sig_Nm_w = find_hm_Nm_F2(Ne_w,
                                               h_centered,
                                               Sig_NE=Sig_Ne_w)
예제 #10
0
eph = load('de421.bsp')

min_to_do = 60
# propagate every minute
for n in range(0, min_to_do, 1):
    nm = timedelta(minutes=n)
    cdate = st_date + nm
    t = ts.utc(cdate.year, cdate.month, cdate.day, cdate.hour, cdate.minute, 0)

    # get the satellite pos
    geocentric = sat.at(t)
    sunlit = sat.at(t).is_sunlit(eph)
    subpoint = wgs84.subpoint(geocentric)

    # get ne and te data
    pt = pyglow.Point(cdate, subpoint.latitude.degrees,
                      subpoint.longitude.degrees, alt)
    pt.run_iri()

    # save data
    ne.append(pt.ne * 100**3)  # convert to m^-3
    te.append(pt.Te)
    daynight.append(sunlit)
    lats.append(subpoint.latitude.degrees)
    lons.append(subpoint.longitude.degrees)

    if n % (min_to_do / 10) == 0:
        print('minutes is', n, 'of ', min_to_do)

print('done propagating')

# break into night and day
예제 #11
0
ze = ze[alt_arr > 150]
lat_arr = lat_arr[alt_arr > 150]
lon_arr = lon_arr[alt_arr > 150]
alt_arr = alt_arr[alt_arr > 150]
O_p_arr = np.zeros_like(alt_arr)
O_arr = np.zeros_like(alt_arr)
Ne_arr = np.zeros_like(alt_arr)
RR1_arr = np.zeros_like(alt_arr)
RR2_arr = np.zeros_like(alt_arr)

D = create_cells_Matrix_spherical_symmetry(ze[::-1], satalt)

for i, alt in enumerate(alt_arr):
    my_f107, my_f107a, my_f107p, my_apmsis = get_msisGPI(
        dn, year_day, f107, f107a, ap, ap3)
    pt = pyglow.Point(dn, lat_arr[i], lon_arr[i], alt, user_ind=True)
    # pt = pyglow.Point(dn, satlat, satlon, alt, user_ind=True)
    pt.f107 = my_f107
    pt.f107a = my_f107a
    pt.f107p = my_f107p
    pt.apmsis = my_apmsis
    pt.run_iri()
    pt.run_msis()

    # Pull necessary constitutents
    O_p_arr[i] = pt.ni['O+']  # O+ density (1/cm^3)
    O_arr[i] = pt.nn['O']  # O density (1/cm^3)
    Ne_arr[i] = pt.ne  # electron density (1/cm^3)

    # Calcualte radiative recombination (equation 17) and mutual neutralization (equation 18)
    a1356 = 7.3e-13  # radiative recombination rate (cm^3/s)
예제 #12
0
# CALL MSIS
#==============================================================================
lat = 0.
lon = 0.
dn = datetime(1992, 3, 20, 0, 2)#year,month,day,hour,minute

MSIS_data = np.zeros((72,144))
marklon = 0
gridspace = 2.5         # 2.5 degree grid spacing

#Loop through lat and lon. select what MSIS values are desired
for Lon in range(-72,72,1) :
    marklat = 0
    for Lat in range(-36,36,1):
        pt = pyglow.Point(dn, Lat*2.5, Lon*2.5, 400) #2.5 degree grid size
        result = pt.run_msis()
        MSIS_data[marklat,marklon] = result.nn['HE']   # helium number density
        marklat = marklat+1
    marklon = marklon+1

F107 = pt.f107
Ap = pt.ap


# LOAD MAGNETIC EQUATOR PTS
#==============================================================================
mag_equator = np.loadtxt("Magnetic_equator_lat_lon.txt", delimiter=',')
magnetic_x = np.linspace(0, 143 / 6, 360)

# Create grid