New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aerovaldb

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aerovaldb

aeroval database to communicate between pyaerocom and aeroval

  • 0.3.0
  • PyPI
  • Socket score

Maintainers
3

aerovaldb - Database combining aeroval and pyaerocom

About

aerovaldb is the database-interface used in the aeroval-API to send data to aeroval database instances like https://aeroval.met.no . Data is usually provided by PyAerocom.

The scope of aerovaldb are:

  1. A well-tested read-interface for reading resources as python-object, json or json_filehandle.
  2. A interface to write/extend python objects to the resources2.
  3. At least one implementation (largely based on json files) implementing the read-interface. (needed for testing)
  4. At least one implementation (largely based on json files) implementing the write-interface.

Our documentation can be found here

Design principles

  1. As pyaerocom-programmer using aerovaldb I want to have documented functions with arguments, e.g. put_heatmap(hm, country, component)
  2. As a pyaerocom-progammer, I want to be able to write to a new datasource/format by just updating a config-file
  3. As a pyaerocom-user, I want to be able to upgrade an experiment without thinking about the dabase format.
  4. From a DB-implementer I want to have a resource-name (table/path) with parameters as dictionary, e.g. open(f"path/to/heatmaps/{country}/{component}.json") or SELECT * FROM PATH_TO_HEATMAPS where country = ? and component = ?
  5. As Web-developer using aerovaldb, I have to map routes to function, and I have parameters for the routes.
  6. As a Web-developer, I don't want to need to know the type of the aerovaldb-implementation and can auto-guess from a location.
  7. As a web-developer, I might need to handle databases in different formats depending on when the user set up the experiment.
  8. For performance, I want to avoid unnecessary json/obj transformations, so I want to put/get obj or json or filehandle and the database might want to decide how to handle that fastest. obj should be the default, json is required, filehandle is optional (and only for get-operations.). (this requirement might be premature optimization? to be discussed ...)
  9. To be discussed: do we want to allow the programmer to set open-modes, e.g. 'r', 'rw', 'w'?

Installation

The most recent stable version of aerovaldb can be installed from pypi like this:

  • pip install aerovaldb

Development versions can be installed directly from Github like this: pip install 'aerovaldb@git+https://github.com/metno/aerovaldb.git'

Usage

Reader, e.g. webserver

import aerovaldb

with aerovaldb.open('json_files:path/to/data/') as db:
    try:
        fh = db.get_map(*args, access_type=aerovaldb.AccessType.FILE_PATH)
        # ... sendfile of filehandle
    except FileNotFoundError as e:
        json = db.get_map(*args, access_type=aerovaldb.AccessType.JSON_STR)
        # ... send json string to client

Writer

import aerovaldb
import json

with aerovaldb.open('json_files:path/to/data/') as db:
    db.put
    obj = {"data": "Some test data"}
    json_str = "{ 'data': 'Some test data' }"
    db.put_map(json_str) # String is assumed to be json string and stored directly.

    db.put_map(obj) # Otherwise serialized object is stored.

API (version 0)

DataGetterSetter
glob_statsdb.get_glob_stats()db.put_glob_stats()
experimentsdb.get_experiments()db.get_experiments()
configdb.get_config()db.get_config()
menudb.get_menu()db.put_menu()
statisticsdb.get_statistics()db.put_statistics()
rangesdb.get_ranges()db.put_ranges()
regionsdb.get_regions()db.put_regions()
models_styledb.get_models_style()db.put_models_style()
mapdb.get_map()db.put_map()
time seriesdb.get_timeseries()db.put_timeseries()
time series weeklydb.get_timeseries_weekly()db.put_timeseries_weekly()
scatterdb.get_scatter()db.put_scatter()
profilesdb.get_profiles()db.put_profiles()
heatmap timeseriesdb.get_heatmap_timeseries()db.put_heatmap_timeseries()
forecastdb.get_forecast()db.put_forecast()
contourdb.get_contour()db.put_contour()
gridded mapdb.get_gridded_map()db.put_gridded_map()
reportdb.get_report()db.put_report()

Copyright (C) 2024 Augustin Mortier, Thorbjørn Lundin, Heiko Klein, Norwegian Meteorological Institute

This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License along with this library; if not, see https://www.gnu.org/licenses/

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc