D
D
Dmitry Krapivin2018-04-17 17:17:41
Database design
Dmitry Krapivin, 2018-04-17 17:17:41

How to design a weather database (meteo parameters are different)?

Good afternoon,
it is necessary to develop a database to store information about the weather, what is the weather in different places, the fact and the forecast.
Experience is not enough, so I would like to contact you!
The conditions are the following parameters: Weather station (Name, Coordinates), Airport (Name, coordinates), Date and time of measurement, temperature, pressure, wind speed...
Forecast and fact.
I guess you can do the following:


Meteostation
id, Dolgota, Shirota
Aeroport
id, Dolgota, Shirota
weather
id, temperature, veter, pressure, measuring_time, ...
weather_prognoz
id, temperature, wind, measuring_time, ...
...

But there is one thing:
1) The weather at the airport and the weather station uses different meteorological parameters. For example:
At the airport: Pressure, Wind speed, Date and time of measurement
At the station: Temperature, wind speed, Date and time of measurement
How to implement it? ..
2) Weather is actual and forecast. Forecast data not for all meteorological parameters. And for example: Temperature forecast, wind forecast.
How to implement it?
Help me please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Makarov, 2018-04-20
@kiru

Option 1 - according to the table per parameter:

Location:
  - Id: INT NOT NULL
  - Type: ENUM NOT NULL
  - Position: GEOGRAPHY NOT NULL (или оставьте пару даблов для координат)

Temperature:
  - LocationId -> Location.Id (вн. ключ)
  - Time: DATETIME NOT NULL
  - Value: DOUBLE PRECISION NOT NULL;

Pressure:
  ...

WindSpeed:
  ...

Option 2 - all together, but with NULLs, each entry in the Measurement table is one fact (i.e. one procedure) of the measurement:
Location:
  - Id: INT NOT NULL
  - Type: ENUM NOT NULL
  - Position: GEOGRAPHY NOT NULL (или оставьте пару даблов для координат)

Measurement:
  - LocationId: -> Location.Id
  - Time: DATETIME NOT NULL
  - Temperature: DOUBLE PRECISION;
  - Pressure: DOUBLE PRECISION;
  - WindSpeed: DOUBLE PRECISION;

For the forecast, respectively, the same tables (TemperatureForecast, for example).
If there will be a lot of data, look towards Time-Series databases (example: https://docs.timescale.com/v0.9/introduction/data-model ), if there will be a lot of spatial queries - take PostgreSQL + PostGIS, especially if you will have geo objects of other types, such as polygons. PostGIS has special types of fields for the geometries of such objects, plus special indexes are implemented. If you still don't know what to choose, but you plan to work with such objects, you can try PostGIS.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question