Files for this exercise

  • All files are available on the git repository stored in the faculty’s Gitlab server.
  • The address of the project is the following:
  • The repository contains the following files:
    • Visualizing AMON SN02 data.ipynb
      • 7 tasks in total
    • Observing variations in the data.ipynb
      • depends on the result of Visualizing AMON SN02 data.ipynb
      • 3 tasks in total
    • space-lab:
      • plot_aac_data.ipynb – 2 mandatory tasks
      • plot_amon_data.ipynb – only bonus tasks, just run the notebook and observe the results
      • plot_gnss_data.ipynb – only bonus tasks, just run the notebook and observe the results
      • plot_weather_data.ipynb – only bonus tasks, just run the notebook and observe the results
  • Data processed in the notebooks are available here:

Setup of the environment

  • Setup of the python environment
    • The python and necessary libraries can be installed locally, or the examined jupyter notebooks can be run in cloud-based solutions such as Google Colaboratory.
    • Python 3.X installation
    • Environment setup:
      • Virtual environments (venv, conda) are recommended for the local installation.
        • For pip, the virtual environment can be set-up by the following command:
          python3 -m virtualenv -p python3 venv
          # activation
          . venv/bin/activate
      • Required non-standard libraries are listed in requirements.txt file
      • If you have problems with some dependency versions don’t bother, try installing any available versions:
        • pip install numpy pandas matplotlib seaborn astropy timezonefinder
      • With pip package installer, all required packages can be installed via:
        pip install -r requirements.txt
    • Google Colab
      • Although the environment already provides many popular packages not all packages are installed.
      • Google Colab supports pip package manager. Thus packages can be installed using pip from the notebook itself (use built-in magic command %%bash).
      • To use files in Google Drive (such as requirements.txt), the Google Drive directories can be mounted in a notebook using library (see the example notebook). Shell commands can be executed from a jupyter notebook by putting an exclamation point as the first letter of a line (example of shell commands in IPython).

Lab activities

Visualization, filtering and resampling of AMON SN02 data

TASK #1: Visualize the subset referenced by variable day_around_the_peak_df

  • Take an inspiration from the code above.
  • No resampling is required in this case.

TASK #2: Review the data in AMON-new viewer web application (no code required)

TASK 3#: Calculate sun positions from the detector’s location

TASK #4: Use appropriate function to convert time zone of subset data (referenced by day_around_the_peak_df)

TASK 5#: Apply mask to the localized data and visualize altitude (elevation) in the local time

  • First, apply masks to dataframe with local time (day_around_the_peak_local_df).
  • Second, create an updated visualization
  • You can base your implementation on the code above

TASK #6: Load file with the precalculated zenith-angles

  • Preserve column names datemoon_zenithsun_zenith,
  • Make column date index, and do not forget to parse is as datetime
  • Either read the file
    • form a local directory: data/sn02_zen_angles_2017-09-27_2019-02-01.csv.gz
    • or download it from a remote server:

TASK #7: Apply the same filter criteria to all data (mexico_w_angles_df) as for the subset analysed above

  • Store the result in DataFrame referenced by variable night_mexico_w_angles_df
  • See: pd.DataFrame.query()

Observing variations in the data

TASK #1: Resample the data into weekly bins

TASK 2#: overlay observations for each day on top of each other

TASK 3#: overlay histograms of the observations for each day on top of each other

Exercise – AAC data

TASK 1#: Calculate 50% and 90% percentiles for values in a picture captured with the green filter

  • Store results in: acc_G_percentile_50acc_G_percentile_90
  • Base your code on the code above.

TASK #2: Subtract N image from G image

  • Consider current datatypes of the arrays, allow negative results.
  • This task will be expanded at later labs.

Additional details

The AMON data used for evaluetion of airglow need to be filtered by removal of light from the Moon and the Sun.

The coordinates of these stelar objects are defined using the Horiznotal coordinate system. See:

Horizontal coordinates
Horizontal coordinates (Credit: Wikimedia commons. Author: TWCarlson CC BY-SA 3.0)

AMON SN02 (Mexico, Baja California) – Timezones

  • In mooncalc, it is UTC-7 (to get UTC add 7 hours)
  • In amonvis database, it is Etc/GMT+8 
  • Wikipedia:
    • UTC−08:00 – As standard time (Northern Hemisphere winter) – Baja California[3]
    • UTC−07:00 – As daylight saving time (Northern Hemisphere summer) – Baja California[4]
    • Universal Time Coordinated
      • GMT / UTC
      • UTC-8
    • Daylight Saving Time
      • PDT: Pacific Daylight Time (North America)
      • UTC-7
    • Standard Time
      • PST: Pacific Standard Time (North America)
      • Currently in use
  • In astropy, to get correct moon azimuth, it gives a correct result when UTC time is used (no modification)
    • Skyfield gives same values as astropy for 21 : 2017-03-31 21:00:00 UTC
      • When timezone is UTC-x then shift time forward x+1
      • -4 : 2017-03-30 20:00:00 UTC   (is close)