Ejemplo n.º 1
0
# 3rd-party imports
import numpy as np

# Local imports
#from pyRT_DISORT.preprocessing.model.atmosphere import Layers
from pyRT_DISORT.preprocessing.model.atmosphere import ModelAtmosphere
from pyRT_DISORT.preprocessing.utilities.external_files import ExternalFile
from pyRT_DISORT.preprocessing.model.aerosol_column import Column as NewColumn
from pyRT_DISORT.preprocessing.model.aerosol import Aerosol
from pyRT_DISORT.preprocessing.model.vertical_profiles import Conrath, Uniform, Layers, ProfileHolder

atmFile = ExternalFile(
    '/home/kyle/repos/pyRT_DISORT/pyRT_DISORT/data/planets/mars/aux/mars_atm.npy'
)
ma = ModelAtmosphere(atmFile.array, atmFile.array[:, 0])

dustFile = ExternalFile(
    '/home/kyle/repos/pyRT_DISORT/pyRT_DISORT/data/planets/mars/aux/dust_properties.fits'
)
radii = np.array([1, 1.2, 1.4])
wavs = np.array([1, 9.3])
wavref = np.array([12.1, 12.1, 12.1])
aero = Aerosol(dustFile.array['primary'].data,
               radii,
               wavs,
               wavelength_grid=dustFile.array['wavelengths'].data,
               reference_wavelengths=wavref)

sh = np.array([10, 10, 10])
nu = np.array([0.5, 0.5, 0.5])
c = Conrath(ma, sh, nu)
Ejemplo n.º 2
0
from pyRT_DISORT.preprocessing.controller.unsure import Unsure
from pyRT_DISORT.preprocessing.controller.control import Control
from pyRT_DISORT.preprocessing.model.boundary_conditions import BoundaryConditions
from pyRT_DISORT.preprocessing.model.rayleigh import RayleighCo2
from pyRT_DISORT.preprocessing.model.surface import HapkeHG2Roughness
from pyRT_DISORT.preprocessing.model.aerosol import ForwardScatteringProperty, ForwardScatteringProperties
from pyRT_DISORT.preprocessing.utilities.external_files import ExternalFile
from pyRT_DISORT.preprocessing.model.atmosphere import ModelGrid
from pyRT_DISORT.preprocessing.model.aerosol_column import Column
from pyRT_DISORT.preprocessing.model.vertical_profiles import Conrath
from pyRT_DISORT.preprocessing.model.new_phase_function import LegendreCoefficients, HenyeyGreenstein, TabularLegendreCoefficients

import numpy as np

# Define some files I'll need
dust_phase = ExternalFile(os.path.join(get_data_path(), 'planets/mars/aux/dust_phase_functions.npy'))
dust_phase_radii = ExternalFile(os.path.join(get_data_path(), 'planets/mars/aux/dust_phase_function_radii.npy'))
dust_phase_wavs = ExternalFile(os.path.join(get_data_path(), 'planets/mars/aux/dust_phase_function_wavelengths.npy'))
ice_coeff = ExternalFile(os.path.join(get_data_path(), 'planets/mars/aux/legendre_coeff_h2o_ice.npy'))
dustfile = ExternalFile(os.path.join(get_data_path(), 'planets/mars/aux/dust.npy'))
icefile = ExternalFile(os.path.join(get_data_path(), 'planets/mars/aux/ice.npy'))
atm = ExternalFile(os.path.join(get_data_path(), 'planets/mars/aux/mars_atm_copy.npy'))
altitude_map = ExternalFile(os.path.join(get_data_path(), 'planets/mars/aux/altitude_map.npy'))
solar_spec = ExternalFile(os.path.join(get_data_path(), 'aux/solar_spectrum.npy'))
albedo_map = ExternalFile(os.path.join(get_data_path(), 'planets/mars/aux/albedo_map.npy'))

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Preprocessing steps
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Step 0.0: Read in the atmosphere file
atmFile = ExternalFile(os.path.join(get_data_path(), 'planets/mars/aux/mars_atm.npy'))
Ejemplo n.º 3
0
import numpy as np
from pyRT_DISORT.preprocessing.utilities.external_files import MultipleExternalFiles, ExternalFile
from pyRT_DISORT.preprocessing.utilities.create_fits import CreateFits

# This example will read in the .phsfn files for ice within the folder /home/kyle/disort_multi/phsfn/
# On my computer that folder contains .dat, .coef, and .phsfn files for dust along with just .phsfn files for ice
# It's mainly just to show you how to use my classes to create multidimensional arrays

f = MultipleExternalFiles(
    '*v2*', '/home/kyle/dustFiles')  # Change this to work with your system
# print(f.files)    # print out the absolute paths of all the files, if desired

# Construct 1D arrays of the wavelengths and radii corresponding to these files. I'll work on a better solution
f0 = ExternalFile('/home/kyle/dustFiles/tmq_mod1_r001v030_forw_v2.dat',
                  text1d=False,
                  header_lines=3)
wavs = f0.array[:, 0]
radii = np.array(
    [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9, 1, 1.5, 2, 2.5, 3])

dust = np.zeros((len(radii), len(wavs), 3))  # shape: 14, 331, 3
print(dust.shape)

# Fill in the empty array with all the values from the files
radius_index = 0
for counter, file in enumerate(f.files):
    # Start by reading in file as a numpy array
    ext_file = ExternalFile(file, header_lines=3, text1d=False)

    dust[counter, :, :] = ext_file.array[:, 1:]
Ejemplo n.º 4
0
# 3rd-party imports
import numpy as np
from scipy.constants import Boltzmann

from pyRT_DISORT.preprocessing.model.atmosphere import ModelAtmosphere, Layers
from pyRT_DISORT.preprocessing.utilities.external_files import ExternalFile

f = ExternalFile(
    '/home/kyle/repos/pyRT_DISORT/pyRT_DISORT/data/planets/mars/aux/mars_atm.npy'
)
lay = Layers(f.array)
#print(lay.pressure_layers)

print(lay.column_density_layers)

#print(f.array)

ma = ModelAtmosphere(f.array, f.array[:, 0])
#print(ma.pressure_grid)
print(ma.column_density_layers)
Ejemplo n.º 5
0
import os
from pyRT_DISORT.data.get_data import get_data_path
from pyRT_DISORT.preprocessing.utilities.external_files import ExternalFile
from pyRT_DISORT.preprocessing.utilities.fit_phase_function import PhaseFunction

ice_phase_function = ExternalFile(os.path.join(
    get_data_path(), 'planets/mars/aux/ice_shape001_r030_00321.dat'),
                                  header_lines=3,
                                  text1d=False)
pf = PhaseFunction(ice_phase_function.array)
created_coefficients = pf.create_legendre_coefficients(n_moments=128,
                                                       n_samples=361)
print(created_coefficients)