IAGOS.apps.database.deployments

Aircraft

class IAGOS.apps.database.deployments.models.Aircraft(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table aircraft. An aircraft has a registration code, a serial number, and an internal number. Every aircraft has an aircraft type and is assigned to an airline. Furthermore, an aircraft has an availability period that saves when the aircraft is available for operations.

Important

Besides the constraints for the attributes, the class implements the following additional logical constraints:

  • The active_from must be before active_end.

  • All deployments that are assigned to the aircraft must be inside the availability period.

  • All flights that are assigned to the aircraft must be inside the availability period.

Warning

If an aircraft is deleted, every related deployment and every related flight will also be deleted

Parameters
  • name (string) – Name of the aircraft (optional)

  • airline (Airline) – Airline of the aircraft

  • aircraft_type (AircraftType) – Type of the aircraft

  • registration_code (string) – Active aircraft identification

  • serial_no (string) – Unique aircraft identification

  • internal_no (integer) – Internal project number

  • active_from (datetime) – Active from

  • active_to (datetime) – Active to (optional)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

clean(*args, **kwargs)

Cleans the model.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

deployments_are_valid()

Returns if all related deployments are inside the period.

Returns

True if so, False otherwise.

Return type

bool

flights_are_valid()

Returns if all related flights are inside the period.

Returns

True if so, False otherwise.

Return type

bool

is_valid()

Returns if the instance is valid. If so, the method returns (True, ‘’). Otherwise, the method will return (False, message) whereby the message explains why the entry is not valid.

Returns

Valid status and the message (valid, error message)

Return type

tuple(bool, string)

period_is_valid()

Returns if the period is valid (active_from < active_to).

Returns

True if the period is valid, false otherwise.

Return type

bool

save(*args, **kwargs)

Saves the model after checking the constrains.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

AircraftType

class IAGOS.apps.database.deployments.models.AircraftType(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table aircraft_type. An aircraft type has a unique name and is used to classify aircraft.

Warning

If an aircraft-type is deleted, every related aircraft will also be deleted

Parameters

name (string) – Name of the type (e.g. A340-600)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Airline

class IAGOS.apps.database.deployments.models.Airline(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table airline. An airline has a unique name and a unique code. Every Aircraft has to be assigned to an airline.

Warning

If an airline is deleted, every related aircraft will also be deleted

Parameters
  • name (string) – Name of the airline (e.g. Deutsche Lufhanse AG)

  • code (string) – 3 letter code (e.g. DLH)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Airport

class IAGOS.apps.database.deployments.models.Airport(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table airport. An airport has a unique name, a unique IATA code, and a position. Furthermore, an airport is assigned to a country and a region. Note that the availability of the airport will not managed in the database.

Important

Besides the constraints for the attributes, the class implements the following additional logical constraints:

  • Every position (longitude, latitude, altitude) must be unique

Warning

If an airport is deleted, every related flight will also be deleted

Parameters
  • region (Region) – Region of the airport (optional)

  • country (Country) – Country of the airport

  • name (string) – Name of the airport (e.g. Frankfurt Airport)

  • iata_code (string) – IATA-code of the airport (e.g. FRA)

  • altitude (decimal) – Altitude

  • latitude (decimal) – Latitude

  • longitude (decimal) – Longitude

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Campaign

class IAGOS.apps.database.deployments.models.Campaign(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table campaign. Campaigns have a unique name and a description. Every campaign is limited in time and has a number of deployments.

Important

Besides the constraints for the attributes, the class implements the following additional logical constraints:

  • The start of the campaign must be before the end of the campaign

  • The period of the campaign must be inside the project period

  • All deployments that are assigned to the campaign must be inside the campaign period

Parameters
  • project (Project) – Related project

  • deployments (Deployment) – Location of the deployment

  • name (string) – Name of the campaign

  • description (string) – Description of the compaign [optional]

  • start (datetime) – Startdate of the campaign

  • end (datetime) – Enddate of the campaign [optional]

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

campaign_period_is_in_project_period()

Returns if the campaign period is inside of the project period.

Returns

True if the period is inside project period, false otherwise.

Return type

bool

clean(*args, **kwargs)

Cleans the model.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

deployments_are_valid()

Returns if the period of the deployments are inside in the campaign period.

Returns

True if the deployments are valid, false otherwise.

Return type

bool

has_project()

Returns if the field project is not None.

Returns

True if the project is not None, false otherwise.

Return type

bool

is_valid()

Returns if the parameter of the instance are valid.

Returns

Valid status and the message (valid, error message)

Return type

tuple(bool, string)

period_is_valid()

Returns if the given period is valid. (start < end).

Returns

True if the period is valid, false otherwise.

Return type

bool

save(*args, **kwargs)

Saves the model after checking the constrains.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

Country

class IAGOS.apps.database.deployments.models.Country(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table country. A country has a unique name and is referred by airports and measurement locations.

Warning

If a country is deleted, every related location and every related airport will also be deleted.

Parameters

name (string) – Full name of the country (e.g. Germany)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Deployment

class IAGOS.apps.database.deployments.models.Deployment(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table deployment. Every deployment is assigned to a project. It shouldn’t be possible that a deployment without an assigned project exists. The deployed component could be installed at a location or in an aircraft.

Important

Besides the constraints for the attributes, the class implements the following additional logical constraints:

  • The start of the deployment must be before the end of the deployment

  • The period of the deployment must be inside the project period

  • Two deployments of the same component can not overlap

  • The deployment period must be inside the availability period of the location or the aircraft

  • All series periods must be inside the deployment period

Warning

If a deployment is deleted, every related series will also be deleted

Parameters
  • project (Project) – Project of the deployment

  • start (datetime) – Start of the deployment

  • end (datetime) – End of the deployment

  • component (Component) – Related component

  • aircraft (Aircraft) – Aircraft

  • measurement_location (MeasurementLocation) – MeasurementLocation

  • comments (text) – Comments to the deployment (optional)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

property calibrations

Returns the pre and the post calibration of the instrument.

Returns

(Pre-calibration, Post-calibration)

Return type

(Calibration, Calibration)

clean(*args, **kwargs)

Cleans the model.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

component_already_installed()

Returns if the installation is overlapping with another installation. Call only this method when removal_timestamp is null.

Returns

True if no overlapping, false otherwise.

Return type

bool

component_is_valid()

Returns if a component is given and checks the periods.

Returns

True if the component is valid, False otherwise.

Return type

bool

dataseries_are_valid()

Returns if the data series are inside the deployment period.

Returns

True if the data series are inside, False otherwise.

Return type

bool

property flights

Returns the flights of the deployment.

Returns

Flights of the deployment

Return type

QuerySet(Flight)

static get_all_deplomyent_components()

Returns all components that were used in the table deployment.

Returns

Components

Return type

QuerySet(Component)

static get_all_deployment_aircrafts()

Returns all aircrafts that were used in the table deployment.

Returns

Aircrafts

Return type

QuerySet(Aircraft)

static get_deployments(timestamp)

Returns the deployments in that the timestamp is included.

Parameters

timestamp (datetime) – Timestamp

Returns

Deployments that includes the timestamp

Return type

QuerySet(Deployment)

has_component()

Returns if the field component is not None.

Returns

True if component is not None, False otherwise

Return type

bool

has_only_one_location()

Returns if exact one location is setted.

Returns

True if one location is setted, False otherwise

Return type

bool

has_project()

Returns if the field project is not None.

Returns

True if project is not None, False otherwise

Return type

bool

property installed_components

Returns the components that were installed during the deployment.

Returns

The location of the deployment.

Return type

QuerySet(ComponentRelation)

is_valid()

Returns if the instance is valid. If so, the method returns (True, ‘’). Otherwise, the method will return (False, message) whereby the message explains why the entry is not valid.

Returns

Valid status and the message (valid, error message)

Return type

tuple(bool, string)

property location

Returns the location of the deployment.

Returns

The location of the deployment.

Return type

Aircraft or MeasurementLocation

period_is_valid()

Returns if the given period is valid (start < end).

Returns

True if the period is valid, false otherwise.

Return type

bool

project_is_valid()

Returns if a project is given and checks the periods.

Returns

True if the project is valid, false otherwise.

Return type

bool

save(*args, **kwargs)

Saves the model after checking the constrains.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

Flight

class IAGOS.apps.database.deployments.models.Flight(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table flight. Every flight is operated by an aircraft and is assigned to two airports. A flight has a flight period and a flight ID.

Important

Besides the constraints for the attributes, the class implements the following additional logical constraints:

  • The flights of an aircraft can not overlap

  • Every flight must be inside the availability period of the aircraft

Parameters
  • aircraft (Aircraft) – Aircraft

  • departure_airport (Airport) – Departure airport

  • arrival_airport (Airport) – Arrival airport

  • departure (datetime) – Departure datetime of the flight

  • arrival (datetime) – Arrival datetime of the flight

  • flight_id (integer) – ID of the flight (optional)

  • comments (string) – Comments (optional)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

aircraft_is_available()

Returns if the flight period is inside the availability period of the aircraft.

Returns

True if the period is inside the availability, False otherwise

Return type

bool

clean(*args, **kwargs)

Cleans the model.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

property data_series

Returns data series of the flight.

Returns

All data series

Return type

QuerySet(DataSeries>)

property deployments

Returns all deployments of the flight.

Returns

All deployments

Return type

QuerySet(Deployment)

flight_period_is_valid()

Returns if the flight collides with an entry in the database.

Returns

True if the flight no collides with another, False otherwise.

Return type

bool

static get_all_aircrafts()

Returns all aircrafts that were used in the table flight.

Returns

Aircrafts

Return type

QuerySet(Aircraft)

static get_all_arrival_airports()

Returns all arrival airports that were used in the table flight.

Returns

Airports

Return type

QuerySet(Airport)

static get_all_departure_airports()

Returns all departure airports that were used in the table flight.

Returns

Airports

Return type

QuerySet(Airport)

static get_flight(aircraft, timestamp)

Returns the flight with the given aircraft that includes the timestamp.

Parameters
  • aircraft (Aircraft) – Aircraft that made the flight

  • timestamp (datetime) – Timestamp that should be included by the flight

Returns

Flight

Return type

Flight

has_aircraft()

Returns if the field aircraft is not None.

Returns

True if aircraft is not None, False otherwise.

Return type

bool

is_valid()

Returns if the instance is valid. If so, the method returns (True, ‘’). Otherwise, the method will return (False, message) whereby the message explains why the entry is not valid.

Returns

Valid status and the message (valid, error message)

Return type

tuple(bool, string)

period_is_valid()

Returns if the given period is valid (departure < arrival).

Returns

True if the period is valid, False otherwise.

Return type

bool

save(*args, **kwargs)

Saves the model after checking the constrains.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

GeoCoordinate

class IAGOS.apps.database.deployments.models.GeoCoordinate(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table geo_coordinate. A geographical point is defined by longitude value and a latitude value. Moreover, every point needs to be assigned to a region. Instances of the class can be used to define a polygon.

Parameters
  • region (Region) – Related region

  • longitude (float) – Longitude of the point

  • latitude (float) – Latitude of the point

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

MeasurementLocation

class IAGOS.apps.database.deployments.models.MeasurementLocation(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table measurement_location. You can deploy instruments at fixed locations (also known as station). An example of a measurement location is the SAPHIR chamber. A location has a unique name, a short description, and a position. A location has an availability period that saves when was the location available for measurements. Furthermore, a location has to be assigned to a country.

Important

Besides the constraints for the attributes, the class implements the following additional logical constraints:

  • The active_from must be before active_end

  • All deployments that are assigned to the location must be inside the availability period

Warning

If a location is deleted, every related deployment will also be deleted

Parameters
  • country (Country) – Country of the location

  • region (Region) – Region of the location

  • name (string) – Name of the location

  • description (string) – Description of the location (optional)

  • altitude (decimal) – Altitude

  • latitude (decimal) – Latitude

  • longitude (decimal) – Longitude

  • active_from (datetime) – Active from

  • active_to (datetime) – Active to (optional)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

clean(*args, **kwargs)

Cleans the model.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

deployments_are_valid()

Returns if all related entries of the table deployments are inside the availability period.

Returns

True if all entries are inside the period, False otherwise.

Return type

bool

is_valid()

Returns if the instance is valid. If so, the method returns (True, ‘’). Otherwise, the method will return (False, message) whereby the message explains why the entry is not valid.

Returns

Valid status and the message (valid, error message)

Return type

tuple(bool, string)

period_is_valid()

Returns if the period is valid. (active_from < active_to).

Returns

True if the period is valid, false otherwise.

Return type

bool

save(*args, **kwargs)

Saves the model after checking the constrains.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

Project

class IAGOS.apps.database.deployments.models.Project(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table project. A project has a unique name, a long name, and a short description. Projects are limited in time and have a period. There are short projects (3-4 years) and research infrastructures (over 20 years). During a project, several deployments will be performed. Each deployment period must be inside the project period. Campaigns are a part of the project and have to be assigned to a project.

See also

Important

Besides the constraints for the attributes, the class implements the following additional logical constraints:

  • The start of the project must be before the end of the project

  • The series of the project must be inside the project period

  • The periods of the campaigns must be inside the project period

  • If a project is deleted, every related deployment and every related campaign will also be deleted

Warning

If a project is deleted, every related deployment and every related campaign will also be deleted.

Parameters
  • name (string) – Name of the project (e.g. IAGOS)

  • long_name (string) – Long name of the project (optional)

  • description (string) – Description of the project (optional)

  • start (datetime) – Start date of the project

  • end (datetime) – End date of the project (optional)

  • is_infrastructure (bool) – True if infrastructure, False otherwise

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

campaigns_are_valid()

Returns if the related campaigns are all inside the period period.

Returns

True if campaigns are inside the period, false otherwise.

Return type

bool

clean(*args, **kwargs)

Cleans the model.

Raises

ValidationError – If the instance is not valid.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

deployments_are_valid()

Returns if the related deployments are all inside the period.

Returns

True if deployments are inside the period, False otherwise.

Return type

bool

is_valid()

Returns if the instance is valid. If so, the method returns (True, ‘’). Otherwise, the method will return (False, message) whereby the message explains why the entry is not valid.

Returns

Valid status and the message (valid, error message)

Return type

tuple(bool, string)

period_is_valid()

Returns if the period of the project is valid.

Returns

True if the period is valid, false otherwise.

Return type

bool

save(*args, **kwargs)

Saves the model after checking the constrains.

Raises

IntegrityError – If the instance is not valid.

Parameters
  • args (list) – Arguments

  • kwargs (dict) – Keyword arguments

Returns

None

Return type

None

Region

class IAGOS.apps.database.deployments.models.Region(*args, **kwargs)

Bases: django.db.models.base.Model

This class implements the database table region. Regions can be used for statistical purposes. It’s important to know which measurements were done in a specific region. Especially when you handle long-time measurements, it’s interesting to know the measurements of a specific region. A region has a unique name and several geographical points (polygon).

Warning

If a region is deleted, every related geo point will also be deleted.

Parameters

name (string) – Name of the region

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

static import_regions_from_pandas(df)

Imports the given data from the given DataFrame df and returns the created regions.

Parameters

df (pd.DataFrame) – DataFrame

Returns

Returns the created regions

Return type

QuerySet(Region)