A CLI tool for creating reference sites and observations and updating them with data from their respective API.

As new networks are added, their name should be added as it appears in sfa_reference_data.csv to NETWORK_OPTIONS. A module should be created to handle observation initialization and data update. Each of these network specific modules should implement two functions:

  • initialize_site_observations(api, site)
    • Where api is an io.api.APISession and site is a datamodel.Site.
  • update_observation_data(api, sites, observations, start, end)
    • Where api is an io.api.APISession, sites is the result of APISession.list_sites, observations is the result of APISession.list_observations``start and end are datetime objects.

The module should then be imported and added to NETWORKHANDLER_MAP below, so that it may be selected based on command line arguments. See the existing mappings for an example.


create_site(api, site) Post a new site to the API and create it’s applicable reference observations.
get_apisession(token[, base_url])
initialize_reference_metadata_objects(token, …) Instantiate an API session and create reference sites and observations.
site_df_to_dicts(site_df) Creates a list of site dictionaries ready to be serialized and posted to the api.
update_reference_observations(token, start, …) Coordinate updating all existing reference observations.