Skip to content

NASA-OCO/oco2-car

Repository files navigation

OCO-2 CAR Website

This is for the OCO-2 CAR website that was designed using Python's Bottle library.

DOI

Language Language Language

Overview

The OCO-2 Command Approval Request (CAR) system was built using Python's Bottle library, with a MySQL database backend. The site employs very basic styling from Bootstrap 5, so you are left to style the site the way you would like.

Setup

Authentication to the database, LDAP server, port numbers, and server names are stored in a 'config.json' file that is setup outside of the webroot. Make sure to indicate the path to the file in main.py and any other scripts. This code will require updates to make it work for your use case.

Directories

Several directories store reports, images, and other files. Some may need to be added as empty directories manually as they are not included in the repo.

Directory Structure

Directory Purpose
cars/ Directory for all the CAR PDF files genearted by the site.
database/ Includes information about the database architecture.
docs/ A directory for any documents you want to have links for in the website.
html/ Temporary directory that houses an HTML version of a CAR form before it is converted to a PDF.
kml/ Main directory for all KML files.
kml/paths/ KML files for paths.
kml/sites/ KML files for specific sites.
kml/target_data/ KML files for specific target selections.
kml/temp/ Temporary directory for KML files.
odf/ Directory for any ODF files that need ingestion into the system. Also has switched_targets and target_options files.
plots/ PNG plots that display on the site.
reports/ Directory for reports that are generated by the site's APIs.
site HTML templates for Bottle.
site/images/modis/ PNG MODIS plots.
site/images/viirs/ PNG VIIRS plot.
site/includes/ Contains menu and footer files for the HTML templates.
site/js Javascript files for the HTML templates.
tccon_results/ TCCON-related files related to the Selected Targets page.
tmp/ Directory for temporary files created by the site.
tofs/ Directory where all the TOF files are kept.
utils/ Contains maintenance and update scripts for various parts of the site.

The Website

The website is powered by Python's Bottle library, but launching the main.py script. Remember to set debug=False if using in production. Any credentials should be in the config.json file.

The front end of the tool icludes the following pages:

  • Homepage: Page with a short message that introduces the site.
  • TOFs: This page uploads files (TOFs) that has the observation plan for the week (i.e, what selected targets the instrument will observe). It looks for a new file on the system, which you can import or ignore. You also have the option to upload one of your own. Once a TOF is imported or uploaded, it can send an email out to target staff, letting them know about potential observations. The information about potential targets is logged into the datatbase, so that team members can select from them throughout the week.
  • Sites: A list of sites that are targets for observations. Users can edit existing sites and add new sites.
  • Site Stats: A page that lists how many times a particular site has been observed and when the last observation occured.
  • Selected Targets: This page serves as a record of all observations. Users can click on a site name to bring up all observation information for particular site, see the CAR form associated with a site, and see the emails that were sent out when the TOF for that site was imported or uploaded.
  • Active Targets: A list of upcoming possible targets for the week.
  • Select Target: This form allows users to select a target or targets for a given day. It will generate and email the CAR form to interested parties. It also has site statistics and plots showing recent observations.
  • Future Targets: This page lists potential targets for the upcoming few weeks, allowing team memembers to prioritize certain targets. This would be reflected in the next week's TOF file.
  • Notes: Lets the user add a note for a given date range that shows up on the "Select Target" page.

Database Backend

This website is backed by a local MySQL database. For MySQL, the Python Bottle-MySQL is utilized. The structure of the database can be found in db/oco2car_db_structure.sql.

Example Files

The data that popualates this website comes from a number of files generated by the mission's team. This includes the following types of files:

  • TOF
  • ODF
  • Switched Targets
  • Target Options
  • CAR

You can find find generalized examples of these files in this repo, but they are not necessarily reflective of what is used by the OCO-2 tea and are for exmaples only. Also note that there are several places in main.py and the scripts in utils that you will need to fill in appropriate paths to these types of files.

E-Mail Notificaitons

This site sends a number of email notifications (and text messages) to different users and groups. Please review main.py and the scripts in utils to update placeholder addresses.

Authentication

The site uses LDAP authentication to control access to specific pages. Use the config.json file to add in your LDAP server's information.

A Note on requirements.txt

You may need to remove the mysqlclient requirement from the file, and install it separately through pip or conda.

About

OCO-2 planning software

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published