예제 #1
0
def geom(index=-1):

    data = rd.processing_orbits(1478, 8)
    # read the orbit geometries for the pass
    phase0 = data.geo.phase
    emission0 = data.geo.emission
    sza0 = data.geo.sza
    lat0 = data.geo.Lat
    lon0 = data.geo.Lon

    #phase = phase0[-2:-1]
    #emission = emission0[-2:-1]
    #sza = sza0[-2:-1]
    phase = phase0[np.array(index)]
    emission = emission0[np.array(index)]
    sza = sza0[np.array(index)]
    lat = lat0[np.array(index)]
    lon = lon0[np.array(index)]

    geo = [
        np.array([phase]),
        np.array([emission]),
        np.array([sza]),
        np.array([lat]),
        np.array([lon])
    ]

    return geo
예제 #2
0
def getSPIRflux(lmin=None, lmax=None, idx=0, det=0):
    """
    This function gets the NORMALIZED flux vectors from the SPICAV-IR routine
    within a requested given range of wavelengths.
    You can input an orbital epoch also, default is set at index=0.
    
    lmin and lmax are in nanometers!!
    """
    data = rd.processing_orbits(1478, 8)

    if det == 0:
        r0 = data.r0[:, idx]
        w0 = data.w0[:, idx]
    else:
        r0 = data.r1[:, idx]
        w0 = data.w1[:, idx]

    # drop the "nan's" and normalize the radiance
    w0 = w0[~np.isnan(r0)]
    r0 = r0[~np.isnan(r0)]  # remove nan's

    if (lmin == None) & (lmax == None):
        # get the SPICAV-IR radiance and wavelength data
        r = r0
        w = w0
    else:
        r = r0[(w0 > lmin) & (w0 < lmax)]
        w = w0[(w0 > lmin) & (w0 < lmax)]

    r = r / np.max(r)

    return r, w
예제 #3
0
def getSPIRpol(lmin=None, lmax=None, idx=0, det=0, orbn=1478, orba=8):
    """
    This function returns polarized flux data for a given orbit geometry =idx.
    
    It does not do any processing as done by Loic Rossi to arrive at his selected 
    bands.
    
    pol = (det1 - det0)/(det0 + det1)
    
    Returns: pol,wavelength
    
    Authr: G. Mahapatra
    
    """

    data = rd.processing_orbits(orbn, orba)

    r0 = data.r0[:, idx]
    w0 = data.w0[:, idx]

    r1 = data.r1[:, idx]
    w1 = data.w1[:, idx]

    if (lmin == None) & (lmax == None):
        # get the SPICAV-IR radiance and wavelength data
        r0 = r0
        w0 = w0
        r1 = r1
        w1 = w1
    else:
        lidx = (w0 > lmin) & (w0 < lmax)
        r0 = r0[lidx]
        w0 = w0[lidx]
        r1 = r1[lidx]
        w1 = w1[lidx]

    # calculate the polarization at all the available geometries
    # polarization is calculated as (det1 - det0)/(det0 + det1)
    pol = np.nan_to_num((r1 - r0) / (r0 + r1))

    return pol, w1
예제 #4
0
This script creates errorbars for the degree of polarization 
of SPICAV-IR orbits.

@author: gouravmahapatr, TU Delft
"""

import matplotlib.pyplot as plt
import sys
import os
path = '/Users/gouravmahapatr/Dropbox/PhD/spicav_data'
os.chdir(path)
import read_spicav_ir as rd
import linestyles as ls

# load the data from a specific orbit
data = rd.processing_orbits(1478, 8)

# activate the get_bande()
data.get_bande()

# define the data step
step = 20

# define the index
idx = 0

# get the latitude
lat = data.geo.Lat[idx]

pol = data.band_pol[::step, idx]
pol += 0.0
예제 #5
0
#localtime = data.geo.local_time
#lat = data.geo.Lat
#phase = data.geo.phase
#sza = data.geo.sza
#emission = data.geo.emission
localtime = []
lat = []
phase = []
sza = []
emi = []
azi = []

for i in range(len(orbit_list)):
    orbit_n = orbit_list[i, 0]
    orbit_a = orbit_list[i, 1]
    data = rd.processing_orbits(orbit_n, orbit_a)
    data.geo.calc_azimuth()
    localtime.extend(list(data.geo.local_time))
    lat.extend(list(data.geo.Lat))
    phase.extend(list(data.geo.phase))
    sza.extend(list(data.geo.sza))
    emi.extend(list(data.geo.emission))
    azi.extend(list(data.geo.azimuth))

cosbeta = pmd.get_cosbeta(np.array(phase), np.array(sza), np.array(emi),
                          np.array(azi))  # in radians

beta = np.degrees(np.arccos(cosbeta))  # Converted into degrees
''' Make the geometries file that will be used as an input to the geos_code'''

# first make sure the angles are all in array
예제 #6
0
# -*- coding: utf-8 -*-
"""
Created on Tue May  8 11:32:09 2018

Script to utilize the read_spicav_ir.py function to read and plot spicav IR data set.

@author: Loic Rossi, gouravmahapatr
"""

import read_spicav_ir as rd
import matplotlib.pyplot as plt

"""
load a specific orbit on the basis of its orbit number 
"""
data = rd.processing_orbits(1478,8)


plt.plot(data.geo.Alt_sc)  # plt the spacecraft altitude 
plt.plot(data.geo.time)    # plot the spacecraft time stamp associated with geometry

data.geo.time.shape

plt.plot(data.geo.phase, data.geo.Alt_sc) # plot the phase angle vs. SC alt
plt.plot(data.geo.phase, data.geo.Lat)    # plot phase angle vs. latitude

plt.plot(data.geo.phase, data.geo.emission)
plt.plot(data.geo.phase, data.geo.sza)
data.w0
data.w0.shape
data.w1.shape
# sum the gas opacities across all the layers
bmabs_lbl_tot = np.sum(bmabs_lbl,axis=1,keepdims=True)

# plot
plt.figure(figsize=[8,6]) 
plt.semilogy(wav,bmabs_lbl_tot,c='k',alpha=0.8)
plt.xlim([1.4,1.5])
plt.xlabel('Wavelength ($\mu m$)',fontsize='x-large')
plt.ylabel('Total gas opacity',fontsize='x-large')
plt.grid()
plt.tight_layout()

#%% get the SPICAV-IR data 
# load the data from a specific orbit
if 'data' not in locals():
    data = rd.processing_orbits(2269,8)

# activate the get_bande()
data.get_bande()

# get the latitude 
lat = data.geo.Lat

# get the spicav wavelength
# Note: The actual wavelength differs b/w two flux channels!!
wav_spicav = data.band_wd0[:,0]

# get the values within 1400 and 1500 nm
idx = np.squeeze(np.array(np.where((wav_spicav<=wav.max()*1.e3)&(wav_spicav>=wav.min()*1.e3))))

wav_spicav_lim = wav_spicav[idx]