Class Weather


  • public final class Weather
    extends java.lang.Object
    • Field Detail

      • PROB_OF_PRECIPITATION_ITEM_COUNT

        public static final int PROB_OF_PRECIPITATION_ITEM_COUNT
        See Also:
        Constant Field Values
      • SQL_COMMAND_QUERYTIMECOLUMN

        public static final java.lang.String[] SQL_COMMAND_QUERYTIMECOLUMN
    • Constructor Detail

      • Weather

        public Weather()
    • Method Detail

      • hasCurrentWeatherInfo

        public static boolean hasCurrentWeatherInfo​(Context context)
      • getCurrentWeatherInfo

        public static CurrentWeatherInfo getCurrentWeatherInfo​(Context context)
      • hasUVHIData

        public static boolean hasUVHIData​(Context context)
      • getPollingTime

        public static long getPollingTime​(Context context)
      • sanitizeDatabase

        public static void sanitizeDatabase​(Context context)
      • getMidnightTime

        public static long getMidnightTime​(long time)
      • getNextMidnightTime

        public static long getNextMidnightTime​(long time)
      • getApproxMoonPositionOnSky

        public static float getApproxMoonPositionOnSky​(Weather.WeatherLocation weatherLocation,
                                                       long time)
        Determines the approximate position of the moon on the sky based on rise and set times. Note: to eliminate possible time shifts between rise sets of different days, in most cases this calculation is averaged over three hours.
        Parameters:
        weatherLocation - the location to calculate the value for
        time - the time in UTC (milliseconds)
        Returns:
        the approximate position, where 0 is rise and 1 is set. Returns -1 if the moon is not visible at the time.
      • getApproxSunPositionOnSky

        public static float getApproxSunPositionOnSky​(Weather.WeatherLocation weatherLocation,
                                                      long time)
        Determines the approximate position of the sun on the sky based on sunrise and sunset times. Note: to eliminate possible time shifts between rise sets of different days, in most cases this calculation is averaged over three hours.
        Parameters:
        weatherLocation - the location to calculate the value for
        time - the time in UTC (milliseconds)
        Returns:
        the approximate position, where 0 is sunrise, 0.5 is midday and 1 is sunset. Returns -1 if the sun is not visible at the time.
      • usePreciseIsDaytime

        public static boolean usePreciseIsDaytime​(Weather.WeatherLocation weatherLocation)
        Returns if a precise calculation of day/night time with the Astronomy class makes sense. It makes sense between a latutide of -65° to +65°, but not further south or north.
        Parameters:
        weatherLocation -
        Returns:
      • getSunsetInUTC

        public static long getSunsetInUTC​(Astronomy.Riseset riseset,
                                          long time)
      • getSunriseInUTC

        public static long getSunriseInUTC​(Astronomy.Riseset riseset,
                                           long time)
      • getCivilTwilightMorning

        public static long getCivilTwilightMorning​(Astronomy.Riseset riseset,
                                                   long time)
      • getCivilTwilightMorning

        public static long getCivilTwilightMorning​(Weather.WeatherLocation weatherLocation,
                                                   long time)
      • getCivilTwilightEvening

        public static long getCivilTwilightEvening​(Astronomy.Riseset riseset,
                                                   long time)
      • getCivilTwilightEvening

        public static long getCivilTwilightEvening​(Weather.WeatherLocation weatherLocation,
                                                   long time)
      • getMoonRiseInUTC

        public static long getMoonRiseInUTC​(Astronomy.Riseset riseset,
                                            long time)
      • getMoonSetInUTC

        public static long getMoonSetInUTC​(Astronomy.Riseset riseset,
                                           long time)
      • getMoonPhaseDay

        public static double getMoonPhaseDay​(long time)
        Calculates the moon day from the current time.
        Parameters:
        time - in milliseconds epoch time
        Returns:
        day of the moon phase; range 0 - 29.53
      • getMoonPhase

        public static double getMoonPhase​(long time)
        Calculates the moon phase from the current time.
        Parameters:
        time - in milliseconds epoch time
        Returns:
        the moon phase; range 0 - 1, where 0 is new moon and 0.5 is full moon
      • getMoonPhaseInDegrees

        public static int getMoonPhaseInDegrees​(long time)
        Calculates the moon phase from the current time.
        Parameters:
        time - in milliseconds epoch time
        Returns:
        the moon phase in degrees; range 0 - 360, where 0 is new moon and 180 is full moon
      • isSunriseInIntervalUTC

        public static boolean isSunriseInIntervalUTC​(Astronomy.Riseset riseset,
                                                     long start,
                                                     long stop)
      • isSunsetInIntervalUTC

        public static boolean isSunsetInIntervalUTC​(Astronomy.Riseset riseset,
                                                    long start,
                                                    long stop)
      • toHourMinuteString

        public static java.lang.String toHourMinuteString​(long time)
      • toFullDateTimeString

        public static java.lang.String toFullDateTimeString​(long time)
      • getWindUnitString

        public static java.lang.String getWindUnitString​(int type)
      • getWindString

        public static java.lang.String getWindString​(Context context,
                                                     CurrentWeatherInfo weatherCard)
      • getSimpleDateFormat

        public static java.text.SimpleDateFormat getSimpleDateFormat​(int format)
      • GetDateString

        public static java.lang.String GetDateString​(java.text.SimpleDateFormat simpleDateFormat,
                                                     long time)
      • suitableNetworkAvailable

        public static boolean suitableNetworkAvailable​(Context context)