diff --git a/docs/toardb_fastapi.md b/docs/toardb_fastapi.md index 836ea8ec0d44f213c16865465c19c32ec8e059c1..fefb79486d57114e657b078925682effa5c1243a 100644 --- a/docs/toardb_fastapi.md +++ b/docs/toardb_fastapi.md @@ -178,7 +178,7 @@ | rice_production_year2000 | number | Y2000 rice production amount at station location (units: thousand tons) (Reference: Dataset: http://gaez.fao.org/Main.html) | Yes | | edgar_htap_v2_nox_emissions_year2010 | number | EDGAR emissions inventory for nitrogen oxides (NOx) at 0.1° resolution (Reference: Janssens-Maenhout et al., 2015: http://edgar.jrc.ec.europa.eu/htap_v2/index.php?SECURE=123) | Yes | | omi_no2_column_years2011to2015 | number | Average Y2011-Y2015 tropospheric NO2 columns from OMI at 0.1 degree resolution in units of 10^15 molecules cm-2 (Reference: Krotkov et al., 2016: (no public download)) | Yes | -| htap_region_tier1 | string | The integer denoting the “tier1” region defined in the task force on hemispheric transport of air pollution (TFHTAP) coordinated model studies | Yes | +| htap_region_tier1 | string | The integer denoting the 'tier1' region defined in the task force on hemispheric transport of air pollution (TFHTAP) coordinated model studies | Yes | | etopo_alt | number | Global digital elevation model from diverse global and regional datasets in 1 arc minute resolution (Reference: Amante and Eakins, 2009: https://www.ngdc.noaa.gov/mgg/global/global.html) | Yes | | etopo_min_alt_5km | number | Minimum elevation from the ETOPO1 dataset in an area of 5 km radius around the station location. This can be used to find out if a high altitude station is located in mountaineous terrain or on a plateau (see etopo_relative_alt) | Yes | | etopo_relative_alt | number | Station elevation above the surrounding area. Derived by subtracting the minimum altitude within a 5 km radius around the station location from the actual station altitude | Yes | diff --git a/toardb/data/models.py b/toardb/data/models.py index 8b2ce7aa6b45d66863f0d32882b8b9a523336251..47428b3c3dfa9bdd34b32daaa0929c1ce81775a0 100644 --- a/toardb/data/models.py +++ b/toardb/data/models.py @@ -10,21 +10,22 @@ from toardb.base import Base class Data(Base): - """ Table "public.data" + """ + Table "public.data" - +---------------+--------------------------+-----------+----------+---------+ - |Column |Type |Collation |Nullable |Default | - +===============+==========================+===========+==========+=========+ - | datetime | timestamp with time zone | | not null | | - +---------------+--------------------------+-----------+----------+---------+ - | value | double precision | | not null | | - +---------------+--------------------------+-----------+----------+---------+ - | flags | integer | | not null | | - +---------------+--------------------------+-----------+----------+---------+ + +---------------+--------------------------+-----------+----------+----------------------------------------+ + |Column |Type |Collation |Nullable |Default | + +===============+==========================+===========+==========+========================================+ + | datetime | timestamp with time zone | | not null | | + +---------------+--------------------------+-----------+----------+----------------------------------------+ + | value | double precision | | not null | | + +---------------+--------------------------+-----------+----------+----------------------------------------+ + | flags | integer | | not null | | + +---------------+--------------------------+-----------+----------+----------------------------------------+ | version | character(28) | | not null | '000001.000000.00000000000000'::bpchar | - +---------------+--------------------------+-----------+----------+---------+ - | timeseries_id | integer | | not null | | - +---------------+--------------------------+-----------+----------+---------+ + +---------------+--------------------------+-----------+----------+----------------------------------------+ + | timeseries_id | integer | | not null | | + +---------------+--------------------------+-----------+----------+----------------------------------------+ Indexes: "data_pkey" PRIMARY KEY, btree (timeseries_id, datetime) @@ -53,21 +54,22 @@ class Data(Base): timeseries_id = Column(ForeignKey(Timeseries.id, deferrable=True, initially='DEFERRED'), nullable=False, index=True) class DataArchive(Base): - """ Table "public.data_archive" + """ + Table "public.data_archive" - +---------------+--------------------------+-----------+----------+---------+ - |Column |Type |Collation |Nullable |Default | - +===============+==========================+===========+==========+=========+ - | datetime | timestamp with time zone | | not null | | - +---------------+--------------------------+-----------+----------+---------+ - | value | double precision | | not null | | - +---------------+--------------------------+-----------+----------+---------+ - | flags | integer | | not null | | - +---------------+--------------------------+-----------+----------+---------+ + +---------------+--------------------------+-----------+----------+----------------------------------------+ + |Column |Type |Collation |Nullable |Default | + +===============+==========================+===========+==========+========================================+ + | datetime | timestamp with time zone | | not null | | + +---------------+--------------------------+-----------+----------+----------------------------------------+ + | value | double precision | | not null | | + +---------------+--------------------------+-----------+----------+----------------------------------------+ + | flags | integer | | not null | | + +---------------+--------------------------+-----------+----------+----------------------------------------+ | version | character(28) | | not null | '000001.000000.00000000000000'::bpchar | - +---------------+--------------------------+-----------+----------+---------+ - | timeseries_id | integer | | not null | | - +---------------+--------------------------+-----------+----------+---------+ + +---------------+--------------------------+-----------+----------+----------------------------------------+ + | timeseries_id | integer | | not null | | + +---------------+--------------------------+-----------+----------+----------------------------------------+ Indexes: "data_archive_pkey" PRIMARY KEY, btree (timeseries_id, datetime) diff --git a/toardb/stationmeta/models_annotation.py b/toardb/stationmeta/models_annotation.py index 45bb9f355b13fb12b14509d9ad37aa4c793e8205..7b9d0baa6dec67adab2e790c9bff10b9b1d5995e 100644 --- a/toardb/stationmeta/models_annotation.py +++ b/toardb/stationmeta/models_annotation.py @@ -19,7 +19,8 @@ stationmeta_core_stationmeta_annotations_table = Table('stationmeta_core_station STATIONMETA_ANNOTATIONS_ID_SEQ = Sequence('stationmeta_annotations_id_seq') # define sequence explicitly class StationmetaAnnotation(Base): - """ Table "public.stationmeta_annotations" + """ + Table "public.stationmeta_annotations" +----------------+--------------------------+-----------+----------+--------------------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -36,6 +37,7 @@ class StationmetaAnnotation(Base): +----------------+--------------------------+-----------+----------+--------------------------------------------------------+ | contributor_id | integer | | not null | | +----------------+--------------------------+-----------+----------+--------------------------------------------------------+ + Indexes: "stationmeta_annotations_pkey" PRIMARY KEY, btree (id) "stationmeta_annotations_contributor_id_a5009820" btree (contributor_id) diff --git a/toardb/stationmeta/models_aux.py b/toardb/stationmeta/models_aux.py index 52e96b92b826d4771813a214ef6c8aea0d1c97e1..57c88dac1722fa129eb4f385ec9c42d092655ca9 100644 --- a/toardb/stationmeta/models_aux.py +++ b/toardb/stationmeta/models_aux.py @@ -20,7 +20,8 @@ from toardb.base import Base STATIONMETA_AUX_DOC_ID_SEQ = Sequence('stationmeta_aux_doc_id_seq') #define sequence explicitly class StationmetaAuxDoc(Base): - """ Table "public.stationmeta_aux_doc" + """ + Table "public.stationmeta_aux_doc" +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -35,6 +36,7 @@ class StationmetaAuxDoc(Base): +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ | station_id | integer | | | | +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + Indexes: "stationmeta_aux_doc_pkey" PRIMARY KEY, btree (id) "stationmeta_aux_doc_station_id_17bdb5f2" btree (station_id) @@ -55,7 +57,8 @@ class StationmetaAuxDoc(Base): STATIONMETA_AUX_IMAGE_ID_SEQ = Sequence('stationmeta_aux_image_id_seq') #define sequence explicitly class StationmetaAuxImage(Base): - """ Table "public.stationmeta_aux_image" + """ + Table "public.stationmeta_aux_image" +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -74,6 +77,7 @@ class StationmetaAuxImage(Base): +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ | station_id | integer | | | | +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ + Indexes: "stationmeta_aux_image_pkey" PRIMARY KEY, btree (id) "stationmeta_aux_image_station_id_fbfbdb29" btree (station_id) @@ -103,7 +107,8 @@ class StationmetaAuxImage(Base): STATIONMETA_AUX_URL_ID_SEQ = Sequence('stationmeta_aux_url_id_seq') #define sequence explicitly class StationmetaAuxUrl(Base): - """ Table "public.stationmeta_aux_url" + """ + Table "public.stationmeta_aux_url" +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -118,6 +123,7 @@ class StationmetaAuxUrl(Base): +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ | station_id | integer | | | | +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + Indexes: "stationmeta_aux_url_pkey" PRIMARY KEY, btree (id) "stationmeta_aux_url_station_id_727571bd" btree (station_id) diff --git a/toardb/stationmeta/models_changelog.py b/toardb/stationmeta/models_changelog.py index f380265642287e10a4a8b136c349c4bb0561c832..387c70abe9030f1578ff5925717c4c02a4e23031 100644 --- a/toardb/stationmeta/models_changelog.py +++ b/toardb/stationmeta/models_changelog.py @@ -11,7 +11,8 @@ from toardb.auth_user.models import AuthUser from toardb.base import Base class StationmetaChangelog(Base): - """ Table "public.stationmeta_changelog" + """ + Table "public.stationmeta_changelog" +----------------+--------------------------+-----------+----------+--------------------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -30,6 +31,7 @@ class StationmetaChangelog(Base): +----------------+--------------------------+-----------+----------+--------------------------------------------------------+ | author_id | integer | | not null | | +----------------+--------------------------+-----------+----------+--------------------------------------------------------+ + Indexes: "timeseries_changelog_pkey" PRIMARY KEY, btree (datetime) Foreign-key constraints: diff --git a/toardb/stationmeta/models_core.py b/toardb/stationmeta/models_core.py index 0d598a848fbafbfc9aac39eab028967316f26d26..6a7115fc5bb5d6a2828d26c7f0a8828cb96c7eea 100644 --- a/toardb/stationmeta/models_core.py +++ b/toardb/stationmeta/models_core.py @@ -18,7 +18,8 @@ STATIONMETA_CORE_ID_SEQ = Sequence('stationmeta_core_id_seq') # define sequence # still to be investigated! # ValueError: [ValueError('dictionary update sequence element #0 has length 1; 2 is required',), TypeError('vars() argument must have __dict__ attribute',)] class StationmetaCore_WithoutCoords(Base): - """ Table "public.stationmeta_core" + """ + Table "public.stationmeta_core" +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -45,6 +46,7 @@ class StationmetaCore_WithoutCoords(Base): +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ | additional_metadata | jsonb | | not null | | +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + Indexes: "stationmeta_core_pkey" PRIMARY KEY, btree (id) "stationmeta_core_coordinates_id" gist (coordinates gist_geometry_ops_nd) diff --git a/toardb/stationmeta/models_global.py b/toardb/stationmeta/models_global.py index a740374c0c907b9b8ec70799cdf4e8c63c2c9f6f..14fc8b8bab609c532a58c55da1ff72ce65291830 100644 --- a/toardb/stationmeta/models_global.py +++ b/toardb/stationmeta/models_global.py @@ -13,7 +13,8 @@ from toardb.base import Base STATIONMETA_GLOBAL_ID_SEQ = Sequence('stationmeta_global_id_seq') # define sequence explicitly class StationmetaGlobal(Base): - """ Table "public.stationmeta_global" + """ + Table "public.stationmeta_global" +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -54,6 +55,7 @@ class StationmetaGlobal(Base): +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ | station_id | integer | | not null | | +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + Indexes: "stationmeta_global_pkey" PRIMARY KEY, btree (id) "stationmeta_global_station_id_key" UNIQUE CONSTRAINT, btree (station_id) diff --git a/toardb/stationmeta/models_global_services.py b/toardb/stationmeta/models_global_services.py index 7813a4f82a7dd52a4cbe22e2352d2aaa2cf1baa7..2fdbcc0d6850b02da5f8c8372325e6ad54daa9ab 100644 --- a/toardb/stationmeta/models_global_services.py +++ b/toardb/stationmeta/models_global_services.py @@ -10,7 +10,8 @@ from toardb.base import Base STATIONMETA_GLOBAL_SERVICES_ID_SEQ = Sequence('stationmeta_global_services_id_seq') # define sequence explicitly class StationmetaGlobalService(Base): - """ Table "public.stationmeta_global_services" + """ + Table "public.stationmeta_global_services" +--------------------+------------------------+-----------+----------+---------------------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -27,6 +28,7 @@ class StationmetaGlobalService(Base): +--------------------+------------------------+-----------+----------+---------------------------------------------------------+ | service_url | character varying(200) | | not null | | +--------------------+------------------------+-----------+----------+---------------------------------------------------------+ + Indexes: "stationmeta_global_services_pkey" PRIMARY KEY, btree (id) "stationmeta_global_services_service_url_key" UNIQUE CONSTRAINT, btree (service_url) diff --git a/toardb/stationmeta/models_role.py b/toardb/stationmeta/models_role.py index 7d367e179c045b73bf63b05d64854a5828d90758..acd45d8a10b85dbafb82654229ff73f8089cdca1 100644 --- a/toardb/stationmeta/models_role.py +++ b/toardb/stationmeta/models_role.py @@ -19,7 +19,8 @@ stationmeta_core_stationmeta_roles_table = Table('stationmeta_core_stationmeta_r STATIONMETA_ROLES_ID_SEQ = Sequence('stationmeta_roles_id_seq') # define sequence explicitly class StationmetaRole(Base): - """ Table "public.stationmeta_roles" + """ + Table "public.stationmeta_roles" +------------+---------+-----------+----------+-----------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -32,6 +33,7 @@ class StationmetaRole(Base): +------------+---------+-----------+----------+-----------------------------------------------+ | contact_id | integer | | not null | | +------------+---------+-----------+----------+-----------------------------------------------+ + Indexes: "stationmeta_roles_pkey" PRIMARY KEY, btree (id) "stationmeta_roles_contact_id_3bd9c160" btree (contact_id) diff --git a/toardb/stationmeta/schemas.py b/toardb/stationmeta/schemas.py index 6e22677ebdfe283ecfb7f200a22a531c89977a40..c34dfdfc0bc8c0506b562ccac459d33a41a0cd03 100644 --- a/toardb/stationmeta/schemas.py +++ b/toardb/stationmeta/schemas.py @@ -295,7 +295,7 @@ class StationmetaGlobalBase(BaseModel): rice_production_year2000: float = Field(..., description="Y2000 rice production amount at station location (units: thousand tons) (Reference: Dataset: http://gaez.fao.org/Main.html)") edgar_htap_v2_nox_emissions_year2010: float = Field(..., description="EDGAR emissions inventory for nitrogen oxides (NOx) at 0.1° resolution (Reference: Janssens-Maenhout et al., 2015: http://edgar.jrc.ec.europa.eu/htap_v2/index.php?SECURE=123)") omi_no2_column_years2011to2015: float = Field(..., description="Average Y2011-Y2015 tropospheric NO2 columns from OMI at 0.1 degree resolution in units of 10^15 molecules cm-2 (Reference: Krotkov et al., 2016: (no public download))") - htap_region_tier1: str = Field(..., description="The integer denoting the “tier1” region defined in the task force on hemispheric transport of air pollution (TFHTAP) coordinated model studies") + htap_region_tier1: str = Field(..., description="The integer denoting the 'tier1' region defined in the task force on hemispheric transport of air pollution (TFHTAP) coordinated model studies") etopo_alt: float = Field(..., description="Global digital elevation model from diverse global and regional datasets in 1 arc minute resolution (Reference: Amante and Eakins, 2009: https://www.ngdc.noaa.gov/mgg/global/global.html)") etopo_min_alt_5km: float = Field(..., description="Minimum elevation from the ETOPO1 dataset in an area of 5 km radius around the station location. This can be used to find out if a high altitude station is located in mountaineous terrain or on a plateau (see etopo_relative_alt)") etopo_relative_alt: float = Field(..., description="Station elevation above the surrounding area. Derived by subtracting the minimum altitude within a 5 km radius around the station location from the actual station altitude") diff --git a/toardb/timeseries/models_annotation.py b/toardb/timeseries/models_annotation.py index e24a9624a8e0209b50349c26e610fd07bfe047c3..ccec7bd923f9eef4eb4e563e29587dc2c551355a 100644 --- a/toardb/timeseries/models_annotation.py +++ b/toardb/timeseries/models_annotation.py @@ -18,7 +18,8 @@ timeseries_timeseries_annotations_table = Table('timeseries_timeseries_annotatio TIMESERIES_ANNOTATIONS_ID_SEQ = Sequence('timeseries_annotations_id_seq') # define sequence explicitly class TimeseriesAnnotation(Base): - """ Table "public.timeseries_annotations" + """ + Table "public.timeseries_annotations" +----------------+--------------------------+-----------+----------+----------------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -35,6 +36,7 @@ class TimeseriesAnnotation(Base): +----------------+--------------------------+-----------+----------+----------------------------------------------------+ | contributor_id | integer | | not null | | +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + Indexes: "timeseries_annotations_pkey" PRIMARY KEY, btree (id) "timeseries_annotations_contributor_id_7a1758f6" btree (contributor_id) diff --git a/toardb/timeseries/models_changelog.py b/toardb/timeseries/models_changelog.py index 6e97f382213207e49fe0aa4959da610e642d0bec..1c150db13635a79e850864fb30833b6735287df1 100644 --- a/toardb/timeseries/models_changelog.py +++ b/toardb/timeseries/models_changelog.py @@ -11,7 +11,8 @@ from toardb.auth_user.models import AuthUser from toardb.base import Base class TimeseriesChangelog(Base): - """ Table "public.timeseries_changelog" + """ + Table "public.timeseries_changelog" +----------------+--------------------------+-----------+----------+--------------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -36,6 +37,7 @@ class TimeseriesChangelog(Base): +----------------+--------------------------+-----------+----------+--------------------------------------------------+ | author_id | integer | | not null | | +----------------+--------------------------+-----------+----------+--------------------------------------------------+ + Indexes: "timeseries_changelog_pkey" PRIMARY KEY, btree (datetime) Foreign-key constraints: diff --git a/toardb/timeseries/models_core.py b/toardb/timeseries/models_core.py index ea095e3c079ae18b0b0e85ed90a2c9a6600603c9..9668c38cc861be9884a46085f4aa610488c05a66 100644 --- a/toardb/timeseries/models_core.py +++ b/toardb/timeseries/models_core.py @@ -16,7 +16,8 @@ from toardb.base import Base TIMESERIES_ID_SEQ = Sequence('timeseries_id_seq') # define sequence explicitly class Timeseries(Base): - """ Table "public.timeseries" + """ + Table "public.timeseries" +---------------------+--------------------------+-----------+----------+----------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -55,6 +56,7 @@ class Timeseries(Base): +---------------------+--------------------------+-----------+----------+----------------------------------------+ | programme_id | integer | | not null | 0 | +---------------------+--------------------------+-----------+----------+----------------------------------------+ + Indexes: "timeseries_pkey" PRIMARY KEY, btree (id) "timeseries_station_id_variable_id_label_uniq" UNIQUE CONSTRAINT, btree (station_id, variable_id, label) diff --git a/toardb/timeseries/models_programme.py b/toardb/timeseries/models_programme.py index cb5b40084b3f7d08c62c1e8ef9de55c7fe9a802b..60056a4b27076c1acf6c91678418b1bc0c48716a 100644 --- a/toardb/timeseries/models_programme.py +++ b/toardb/timeseries/models_programme.py @@ -9,7 +9,8 @@ from toardb.base import Base TIMESERIES_PROGRAMMES_ID_SEQ = Sequence('timeseries_programmes_id_seq') # define sequence explicitly class TimeseriesProgramme(Base): - """ Table "public.timeseries_programmes" + """ + Table "public.timeseries_programmes" +-------------+------------------------+-----------+----------+---------------------------------------------------+ | Column | Type | Collation | Nullable | Default | diff --git a/toardb/timeseries/models_role.py b/toardb/timeseries/models_role.py index 6d3d53a702c6a98977ac65650db3cc1c684fd4c3..35ee72a70ec0a6680f682353a0c6aba1f10ef4d8 100644 --- a/toardb/timeseries/models_role.py +++ b/toardb/timeseries/models_role.py @@ -19,7 +19,8 @@ timeseries_timeseries_roles_table = Table('timeseries_timeseries_roles', Base.me TIMESERIES_ROLES_ID_SEQ = Sequence('timeseries_roles_id_seq') # define sequence explicitly class TimeseriesRole(Base): - """ Table "public.timeseries_roles" + """ + Table "public.timeseries_roles" +---------------+---------+-----------+----------+----------------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -32,6 +33,7 @@ class TimeseriesRole(Base): +---------------+---------+-----------+----------+----------------------------------------------+ | contact_id | integer | | not null | | +---------------+---------+-----------+----------+----------------------------------------------+ + Indexes: "timeseries_roles_pkey" PRIMARY KEY, btree (id) "timeseries_roles_role_status_contact_id_uniq" UNIQUE CONSTRAINT, btree (role, status, contact_id) diff --git a/toardb/variables/models.py b/toardb/variables/models.py index 7e2cb505cb8ba97e822bd94efd35702bb0c19086..da657f0eef16cd0a637d47817846e0f04af1fe4d 100644 --- a/toardb/variables/models.py +++ b/toardb/variables/models.py @@ -8,7 +8,8 @@ from toardb.base import Base VARIABLES_ID_SEQ = Sequence('variables_id_seq') # define sequence explicitly class Variable(Base): - """ Table "public.variables" + """ + Table "public.variables" +------------------+------------------------+-----------+----------+---------------------------------------+ | Column | Type | Collation | Nullable | Default | @@ -27,6 +28,7 @@ class Variable(Base): +------------------+------------------------+-----------+----------+---------------------------------------+ | chemical_formula | character varying(128) | | not null | | +------------------+------------------------+-----------+----------+---------------------------------------+ + Indexes: "variables_pkey" PRIMARY KEY, btree (id) "variables_name_key" UNIQUE CONSTRAINT, btree (name)