Пример #1
0
 def test_elevation(self):
     # TODO add asserts
     # print("Elevation(m) Pressure(Pa) Temperature(K)")
     h = 0
     for saved in self.saved_p_t:
         P = get_pressure_with_elevation(h)
         T = get_temperature_with_elevation(h)
         self.assertEqual(saved[1], int(P))
         self.assertEqual(saved[2], int(T))
         # print("%i %i %i" % (h, P, T))
         h += 1000
Пример #2
0
    def __init__(self,
                 latitude,
                 longitude,
                 low: float = WAVELENGTH_MICRONS[0],
                 high: float = WAVELENGTH_MICRONS[-1],
                 n_wvls: int = 200,
                 wavelengths=[],
                 elevation=0.0,
                 pressure=None):

        if low > high:
            low, high = high, low
        if low < WAVELENGTH_MICRONS[0]:
            print("Low wavelength is under data, unpredictable results ahead")
        if high > WAVELENGTH_MICRONS[-1]:
            print("high wl is over source data, unpredictable results ahead")

        self.low, self.high = low, high
        if not len(wavelengths):
            self.wavelengths = np.linspace(WAVELENGTH_MICRONS[0],
                                           WAVELENGTH_MICRONS[-1], n_wvls)
        else:
            self.wavelengths = sorted(wavelengths)
        self.n_wvls = len(wavelengths)
        # default values
        self.aspect = 180.0
        self.elevation = elevation
        if pressure is None:
            pressure = elevation.get_pressure_with_elevation(self.elevation)
        self.pressure = pressure
        # default to 1998 because numbers.
        self.longitude = longitude
        self.latitude = latitude

        # Input reflectivities
        self.spcrfl = [0.2] * 6
        # Input reflectivity wavelengths
        self.spcwvr = [0.3, 0.7, 0.8, 1.3, 2.5, 4.0]
        # Power on Angstrom turbidity
        self.alpha = 1.14
        # Aerosol assymetry factor (rural assumed)
        self.assym = 0.65

        # Aerosol optical depth at 0.5 microns, base e
        # self.tau500 = None  # 0 < tau500 <= 1.0 >0

        # Precipitable water vapor (cm)
        self.watvap = None  # > 0
Пример #3
0
	def setUp(self):
		self.d = datetime.datetime(2003, 10, 17, 19, 30, 30, tzinfo = datetime.timezone.utc)
		print(self.d)
		self.d += datetime.timedelta(seconds = time.get_delta_t(self.d) - time.tt_offset - time.get_leap_seconds(self.d))
		print(self.d)
		  # Reda & Andreas say that this time is in "Local Standard Time", which they
		  # define as 7 hours behind UT (not UTC). Hence the adjustment to convert UT
		  # to UTC.
		self.longitude = -105.1786
		self.latitude = 39.742476
		self.pressure = 82000.0 # pascals
		self.elevation = 1830.14 # meters
		self.temperature = 11.0 + constants.celsius_offset # kelvin
		self.slope = 30.0 # degrees
		self.slope_orientation = -10.0 # degrees east from south
		self.jd = time.get_julian_solar_day(self.d)
		self.jc = time.get_julian_century(self.jd)
		self.jde = time.get_julian_ephemeris_day(self.d)
		self.jce = time.get_julian_ephemeris_century(self.jde)
		self.jme = time.get_julian_ephemeris_millennium(self.jce)
		self.geocentric_longitude = solar.get_geocentric_longitude(self.jme)
		self.geocentric_latitude = solar.get_geocentric_latitude(self.jme)
		self.nutation = solar.get_nutation(self.jce)
		self.sun_earth_distance = solar.get_sun_earth_distance(self.jme)
		self.true_ecliptic_obliquity = solar.get_true_ecliptic_obliquity(self.jme, self.nutation)
		self.aberration_correction = solar.get_aberration_correction(self.sun_earth_distance)
		self.apparent_sun_longitude = solar.get_apparent_sun_longitude(self.geocentric_longitude, self.nutation, self.aberration_correction)
		self.apparent_sidereal_time = solar.get_apparent_sidereal_time(self.jd, self.jme, self.nutation)
		self.geocentric_sun_right_ascension = solar.get_geocentric_sun_right_ascension(self.apparent_sun_longitude, self.true_ecliptic_obliquity, self.geocentric_latitude)
		self.geocentric_sun_declination = solar.get_geocentric_sun_declination(self.apparent_sun_longitude, self.true_ecliptic_obliquity, self.geocentric_latitude)
		self.local_hour_angle = solar.get_local_hour_angle(318.5119, self.longitude, self.geocentric_sun_right_ascension) #self.apparent_sidereal_time only correct to 5 sig figs, so override
		self.equatorial_horizontal_parallax = solar.get_equatorial_horizontal_parallax(self.sun_earth_distance)
		self.projected_radial_distance = solar.get_projected_radial_distance(self.elevation, self.latitude)
		self.projected_axial_distance = solar.get_projected_axial_distance(self.elevation, self.latitude)
		self.topocentric_sun_right_ascension = solar.get_topocentric_sun_right_ascension(self.projected_radial_distance,
		self.equatorial_horizontal_parallax, self.local_hour_angle, self.apparent_sun_longitude, self.true_ecliptic_obliquity, self.geocentric_latitude)
		self.parallax_sun_right_ascension = solar.get_parallax_sun_right_ascension(self.projected_radial_distance, self.equatorial_horizontal_parallax, self.local_hour_angle, self.geocentric_sun_declination)
		self.topocentric_sun_declination = solar.get_topocentric_sun_declination(self.geocentric_sun_declination, self.projected_axial_distance, self.equatorial_horizontal_parallax, self.parallax_sun_right_ascension, self.local_hour_angle)
		self.topocentric_local_hour_angle = solar.get_topocentric_local_hour_angle(self.local_hour_angle, self.parallax_sun_right_ascension)
		self.topocentric_zenith_angle = solar.get_topocentric_zenith_angle(self.latitude, self.topocentric_sun_declination, self.topocentric_local_hour_angle, self.pressure, self.temperature)
		self.topocentric_azimuth_angle = solar.get_topocentric_azimuth_angle(self.topocentric_local_hour_angle, self.latitude, self.topocentric_sun_declination)
		self.incidence_angle = solar.get_incidence_angle(self.topocentric_zenith_angle, self.slope, self.slope_orientation, self.topocentric_azimuth_angle)
		self.pressure_with_elevation = elevation.get_pressure_with_elevation(1567.7)
		self.temperature_with_elevation = elevation.get_temperature_with_elevation(1567.7)
Пример #4
0
	def setUp(self):
		self.d = datetime.datetime(2003, 10, 17, 19, 30, 30, tzinfo = datetime.timezone.utc)
		self.d += datetime.timedelta(seconds = time.get_delta_t(self.d) - time.tt_offset - time.get_leap_seconds(self.d))
		  # Reda & Andreas say that this time is in "Local Standard Time", which they
		  # define as 7 hours behind UT (not UTC). Hence the adjustment to convert UT
		  # to UTC.
		self.longitude = -105.1786
		self.latitude = 39.742476
		self.pressure = 82000.0 # pascals
		self.elevation = 1830.14 # meters
		self.temperature = 11.0 + constants.celsius_offset # kelvin
		self.slope = 30.0 # degrees
		self.slope_orientation = -10.0 # degrees east from south
		self.jd = time.get_julian_solar_day(self.d)
		self.jc = time.get_julian_century(self.jd)
		self.jde = time.get_julian_ephemeris_day(self.d)
		self.jce = time.get_julian_ephemeris_century(self.jde)
		self.jme = time.get_julian_ephemeris_millennium(self.jce)
		self.geocentric_longitude = solar.get_geocentric_longitude(self.jme)
		self.geocentric_latitude = solar.get_geocentric_latitude(self.jme)
		self.nutation = solar.get_nutation(self.jce)
		self.sun_earth_distance = solar.get_sun_earth_distance(self.jme)
		self.true_ecliptic_obliquity = solar.get_true_ecliptic_obliquity(self.jme, self.nutation)
		self.aberration_correction = solar.get_aberration_correction(self.sun_earth_distance)
		self.apparent_sun_longitude = solar.get_apparent_sun_longitude(self.geocentric_longitude, self.nutation, self.aberration_correction)
		self.apparent_sidereal_time = solar.get_apparent_sidereal_time(self.jd, self.jme, self.nutation)
		self.geocentric_sun_right_ascension = solar.get_geocentric_sun_right_ascension(self.apparent_sun_longitude, self.true_ecliptic_obliquity, self.geocentric_latitude)
		self.geocentric_sun_declination = solar.get_geocentric_sun_declination(self.apparent_sun_longitude, self.true_ecliptic_obliquity, self.geocentric_latitude)
		self.local_hour_angle = solar.get_local_hour_angle(318.5119, self.longitude, self.geocentric_sun_right_ascension) #self.apparent_sidereal_time only correct to 5 sig figs, so override
		self.equatorial_horizontal_parallax = solar.get_equatorial_horizontal_parallax(self.sun_earth_distance)
		self.projected_radial_distance = solar.get_projected_radial_distance(self.elevation, self.latitude)
		self.projected_axial_distance = solar.get_projected_axial_distance(self.elevation, self.latitude)
		self.topocentric_sun_right_ascension = solar.get_topocentric_sun_right_ascension(self.projected_radial_distance,
		self.equatorial_horizontal_parallax, self.local_hour_angle, self.apparent_sun_longitude, self.true_ecliptic_obliquity, self.geocentric_latitude)
		self.parallax_sun_right_ascension = solar.get_parallax_sun_right_ascension(self.projected_radial_distance, self.equatorial_horizontal_parallax, self.local_hour_angle, self.geocentric_sun_declination)
		self.topocentric_sun_declination = solar.get_topocentric_sun_declination(self.geocentric_sun_declination, self.projected_axial_distance, self.equatorial_horizontal_parallax, self.parallax_sun_right_ascension, self.local_hour_angle)
		self.topocentric_local_hour_angle = solar.get_topocentric_local_hour_angle(self.local_hour_angle, self.parallax_sun_right_ascension)
		self.topocentric_zenith_angle = solar.get_topocentric_zenith_angle(self.latitude, self.topocentric_sun_declination, self.topocentric_local_hour_angle, self.pressure, self.temperature)
		self.topocentric_azimuth_angle = solar.get_topocentric_azimuth_angle(self.topocentric_local_hour_angle, self.latitude, self.topocentric_sun_declination)
		self.incidence_angle = solar.get_incidence_angle(self.topocentric_zenith_angle, self.slope, self.slope_orientation, self.topocentric_azimuth_angle)
		self.pressure_with_elevation = elevation.get_pressure_with_elevation(1567.7)
		self.temperature_with_elevation = elevation.get_temperature_with_elevation(1567.7)