Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mpartio committed Dec 20, 2023
1 parent 5b104da commit ac5255d
Show file tree
Hide file tree
Showing 24 changed files with 768 additions and 0 deletions.
34 changes: 34 additions & 0 deletions doc/as_grid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Database Table: `as_grid`

### Table Description
The `as_grid` table in the `public` schema is designed to manage grid-based data associated with various forecasts. It includes information about the producer, analysis times, and geometries, along with details about the data schema and table storage.

### Columns
| Column Name | Type | Nullable | Default Value | Description |
| ------------------ | ------------------------------- | -------- | ----------------------------------------- | ------------------------------------------------------ |
| `id` | `integer` | not null | `nextval('as_grid_id_seq'::regclass)` | Unique identifier for each record in the grid table. |
| `producer_id` | `integer` | not null | | Identifier for the producer associated with the grid. |
| `analysis_time` | `timestamp with time zone` | not null | | Timestamp indicating the time of analysis. |
| `geometry_id` | `integer` | not null | | Identifier for the geometry associated with the grid. |
| `schema_name` | `character varying(50)` | not null | | Name of the database schema where the grid is stored. |
| `table_name` | `character varying(50)` | not null | | Name of the database table where the grid is stored. |
| `partition_name` | `character varying(70)` | | | Name of the database partition for the grid data. |
| `record_count` | `integer` | not null | `0` | The count of records in the grid. |
| `delete_time` | `timestamp with time zone` | not null | | Timestamp indicating when the grid data will be deleted. |
| `last_updater` | `text` | | | Information about who last updated the record. |
| `last_updated` | `timestamp with time zone` | | | Timestamp of the last update to the record. |
| `min_analysis_time`| `timestamp with time zone` | | | Earliest analysis time for the grid data. |
| `max_analysis_time`| `timestamp with time zone` | | | Latest analysis time for the grid data. |

### Indexes
- **Primary Key**: `id` (using btree)
- **Unique Constraint**: `as_grid_producer_id_analysis_time_geometry_id_uniq_idx` on columns (`producer_id`, `analysis_time`, `geometry_id`) (using btree)

### Foreign-key Constraints
- **`as_grid_fmi_producer_fkey_02`**: Foreign Key constraint on `producer_id` referencing `fmi_producer(id)`

### Notes
- The table serves as a crucial component in handling grid-based data for various analytical purposes, particularly in meteorological or geographical analyses.
- The combination of `producer_id`, `analysis_time`, and `geometry_id` is ensured to be unique, facilitating precise data management.
- The table also tracks the lifecycle of the grid data, including its creation, update, and planned deletion times.

35 changes: 35 additions & 0 deletions doc/as_previ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Database Table: `as_previ`

### Table Description
The `as_previ` table in the `public` schema is designed to manage data related to point forecasts. It includes details about the producer, analysis times, and storage information.

### Columns
| Column Name | Type | Nullable | Default Value | Description |
| ------------------ | ------------------------------- | -------- | ------------------------------------------ | -------------------------------------------------------- |
| `producer_id` | `integer` | not null | | Identifier for the producer associated with the analysis.|
| `analysis_time` | `timestamp with time zone` | not null | | Timestamp indicating the time of analysis. |
| `schema_name` | `character varying(50)` | not null | | Name of the database schema where the data is stored. |
| `table_name` | `character varying(50)` | not null | | Name of the database table where the data is stored. |
| `partition_name` | `character varying(70)` | | | Name of the database partition for the data. |
| `record_count` | `integer` | not null | `0` | The count of records in the analysis. |
| `delete_time` | `timestamp with time zone` | not null | | Timestamp indicating when the data will be deleted. |
| `last_updater` | `text` | | | Information about who last updated the record. |
| `last_updated` | `timestamp(0) without time zone`| | | Timestamp of the last update to the record. |
| `min_analysis_time`| `timestamp with time zone` | | | Earliest analysis time for the data. |
| `max_analysis_time`| `timestamp with time zone` | | | Latest analysis time for the data. |
| `id` | `integer` | not null | `nextval('as_previ_id_seq'::regclass)` | Unique identifier for each record. |

### Indexes
- **Primary Key**: `id` (using btree)
- **Unique Constraint**: `as_previ_partition_name_uniq` on the column (`partition_name`) (using btree)
- **Unique Index**: `as_previ_producer_id_minmax_analysis_time_uniq_idx` on columns (`producer_id`, `min_analysis_time`, `max_analysis_time`) (using btree)

### Foreign-key Constraints
- **`as_previ_fmi_producer_fkey`**: Foreign Key constraint on `producer_id` referencing `fmi_producer(id)`

### Notes
- The table is instrumental in tracking and managing historical analysis data.
- The primary key ensures unique identification for each record.
- The unique constraints and indexes facilitate the efficient organization and retrieval of data based on specific parameters like analysis times and partition names.
- The table also manages the lifecycle of the analysis data, including creation, updates, and planned deletion times.

29 changes: 29 additions & 0 deletions doc/fmi_producer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Database Table: fmi_producer

### Table Description
This table is designed to store information about various producers. It includes unique identifiers for each producer, their names, descriptions, and references to their class and type.

### Columns
| Column Name | Type | Nullable | Default | Description |
| ------------- | ------------------------------------- | -------- | ------- | ------------------------------------------------- |
| `id` | `integer` | not null | | Unique identifier for each producer. |
| `name` | `character varying(50)` | not null | | Name of the producer. |
| `description` | `text` | | | Description of the producer. |
| `class_id` | `integer` | not null | | Identifier linking to the producer's class. |
| `last_updater`| `text` | | | Information about who last updated the record. |
| `last_updated`| `timestamp(0) without time zone` | | | Timestamp of the last update to the record. |
| `type_id` | `integer` | not null | | Identifier linking to the producer's type. |

### Indexes
- **Primary Key**: `id` (using btree)
- **Unique Constraint**: `fmi_producer_name_uniq` on the column (`name`) (using btree)

### Foreign-key Constraints
- **`fmi_producer_producer_class_fkey`**: Foreign Key constraint on `class_id` referencing `producer_class(id)`
- **`fmi_producer_producer_type_fkey`**: Foreign Key constraint on `type_id` referencing `producer_type(id)`

### Notes
- The `id` column is the primary key and is automatically managed.
- The `name` column has a unique constraint, ensuring no two producers have the same name.
- The `class_id` and `type_id` columns link to the `producer_class` and `producer_type` tables, respectively.

27 changes: 27 additions & 0 deletions doc/forecast_type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Database Table: `forecast_type`

### Table Description
The `forecast_type` table in the `public` schema is designed to categorize different types of forecasts.

Current types are: deterministic, analysis, control forecat, perturbed forecast, statistical processing

Table includes unique identifiers for each forecast type, along with names and descriptions.

### Columns
| Column Name | Type | Nullable | Default Value | Description |
| ------------- | ------------------------------- | -------- | ------------------------------------------ | ---------------------------------------------------- |
| `id` | `integer` | not null | `nextval('forecast_type_id_seq'::regclass)`| Unique identifier for each forecast type. |
| `name` | `character varying(50)` | not null | | Name of the forecast type. |
| `description` | `text` | not null | | Description of the forecast type. |
| `last_updater`| `text` | | | Information about who last updated the record. |
| `last_updated`| `timestamp with time zone` | | | Timestamp of the last update to the record. |

### Indexes
- **Primary Key**: `id` (using btree)
- **Unique Constraint**: `forecast_type_name_uniq` on the column (`name`) (using btree)

### Notes
- The `id` column is auto-incremented using a sequence.
- The `name` column has a unique constraint, ensuring that each forecast type name is distinct.
- The table provides detailed information about each forecast type, including its name and description, and tracks the last updates made.

45 changes: 45 additions & 0 deletions doc/geom_lambert_conformal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Database Table: `geom_lambert_conformal`

### Table Description
The `geom_lambert_conformal` table in the `public` schema is designed to store information about Lambert Conformal Conic geometric projections. This table includes parameters specific to this projection type such as grid dimensions, orientation, and reference points.

### Columns
| Column Name | Type | Nullable | Default | Description |
| -------------- | --------------------------- | -------- | ------- | ------------------------------------------------------------- |
| `id` | `integer` | not null | | Unique identifier for the geometric projection record. |
| `name` | `text` | not null | | Name of the geometric projection. |
| `ni` | `integer` | not null | | Number of grid points along the x-axis (i-coordinate). |
| `nj` | `integer` | not null | | Number of grid points along the y-axis (j-coordinate). |
| `first_point` | `geometry(Point,4326)` | not null | | The first grid point in the projection, specified in WGS 84. |
| `di` | `numeric` | not null | | Grid point spacing along the x-axis. |
| `dj` | `numeric` | not null | | Grid point spacing along the y-axis. |
| `scanning_mode`| `text` | not null | | Scanning mode for the grid. |
| `orientation` | `numeric` | not null | | Orientation of the grid. |
| `latin1` | `numeric` | not null | | First latitude from pole at which the secant cone cuts the sphere. |
| `latin2` | `numeric` | | | Second latitude from pole at which the secant cone cuts the sphere. |
| `south_pole` | `geometry(Point,4326)` | | | Location of the south pole in the projection, specified in WGS 84. |
| `description` | `text` | not null | | Description of the geometric projection. |
| `last_updater` | `text` | | | Information about who last updated the record. |
| `last_updated` | `timestamp with time zone` | | | Timestamp of the last update to the record. |
| `earth_shape_id`| `integer` | | | Reference to an earth shape model. |
| `datum_id` | `integer` | | | Reference to a datum model. |

### Indexes
- **Primary Key**: `id` (using btree)
- **Unique Constraint**: `geom_lambert_conformal_name_uniq` on the column (`name`) (using btree)

### Check Constraints
- **`geom_lambert_conformal_datum_chk`**: CHECK (datum_id IS NULL OR datum_id IS NOT NULL AND earth_shape_id IS NULL)
- **`geom_lambert_conformal_scanning_mode_chk`**: CHECK (scanning_mode = ANY (ARRAY['+x-y'::text, '+x+y'::text]))

### Foreign-key Constraints
- **`geom_lambert_conformal_datum_id_fkey`**: Foreign Key constraint on `datum_id` referencing `datum(id)`
- **`geom_lambert_conformal_earth_shape_id_fkey`**: Foreign Key constraint on `earth_shape_id` referencing `earth_shape(id)`
- **`geom_lambert_conformal_geom_fkey_02`**: Foreign Key constraint on `id` referencing `geom(id)`
- **`geom_lambert_conformal_geom_fkey_03`**: Foreign Key constraint on `name` referencing `geom(name)`

### Notes
- The table is integral for managing Lambert Conformal geometric projections used in various spatial analyses and meteorological applications.
- The unique constraints and indexes ensure that each projection is distinct and easily retrievable.
- The check constraints enforce data integrity, particularly in terms of projection parameters and grid configurations.

42 changes: 42 additions & 0 deletions doc/geom_latitude_longitude.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## Database Table: `geom_latitude_longitude`

### Table Description
The `geom_latitude_longitude` table in the `public` schema is specifically designed to store geometric data in a latitude-longitude grid system. This table includes grid dimensions, spatial references, and other parameters related to geographic positioning.

### Columns
| Column Name | Type | Nullable | Default | Description |
| -------------- | --------------------------- | -------- | ------- | ------------------------------------------------------- |
| `id` | `integer` | not null | | Unique identifier for the geometric grid record. |
| `name` | `text` | not null | | Name of the geometric grid. |
| `ni` | `integer` | not null | | Number of grid points along the x-axis (longitude). |
| `nj` | `integer` | not null | | Number of grid points along the y-axis (latitude). |
| `first_point` | `geometry(Point,4326)` | not null | | The first grid point in the system, specified in WGS 84.|
| `di` | `numeric` | not null | | Grid point spacing along the x-axis (longitude). |
| `dj` | `numeric` | not null | | Grid point spacing along the y-axis (latitude). |
| `scanning_mode`| `text` | not null | | Scanning mode for the grid. |
| `description` | `text` | not null | | Description of the geometric grid. |
| `last_updater` | `text` | | | Information about who last updated the record. |
| `last_updated` | `timestamp with time zone` | | | Timestamp of the last update to the record. |
| `earth_shape_id`| `integer` | | | Reference to an earth shape model. |
| `datum_id` | `integer` | | | Reference to a datum model. |

### Indexes
- **Primary Key**: `id` (using btree)
- **Unique Constraint**: `geom_latitude_longitude_name_uniq` on the column (`name`) (using btree)

### Check Constraints
- **`geom_latitude_longitude_datum_chk`**: CHECK (datum_id IS NULL OR datum_id IS NOT NULL AND earth_shape_id IS NULL)
- **`geom_latitude_longitude_scanning_mode_chk`**: CHECK (scanning_mode = ANY (ARRAY['+x-y'::text, '+x+y'::text]))

### Foreign-key Constraints
- **`geom_latitude_longitude_datum_id_fkey`**: Foreign Key constraint on `datum_id` referencing `datum(id)`
- **`geom_latitude_longitude_earth_shape_id_fkey`**: Foreign Key constraint on `earth_shape_id` referencing `earth_shape(id)`
- **`geom_latitude_longitude_geom_fkey`**: Foreign Key constraint on `id` referencing `geom(id)`
- **`geom_latitude_longitude_geom_fkey_02`**: Foreign Key constraint on `name` referencing `geom(name)`

### Notes
- The table is essential for managing spatial data related to geographic positioning and mapping in a latitude-longitude grid system.
- Unique constraints ensure that each grid is distinct and identifiable by its name.
- The check constraints enforce data integrity, especially in terms of grid configurations and references.
- The table is linked to earth shape and datum models, providing crucial context for spatial data interpretation.

Loading

0 comments on commit ac5255d

Please sign in to comment.