Weather Data

MIN_MAXS (Manually collected minimum and maximum temperature and rain data)

Contains one row for every row in WREADINGS. Each row contains the WREADINGS data and the related TEMPMINS, TEMPMAXS, and RAINGAUGES rows. In those cases where there is a WREADINGS row but not a row from a related table the columns from the related table are NULL.

This view is useful for the analysis of the manually collected weather data.[296]

Warning

The UNadjusted maximum temperature is not shown in this view. That is, when the original maximum temperature was determined to be spurious and has been adjusted in some way, this view does not provide a way to identify which Tempmax values are and are not adjusted. When this information is important to retain, users should use the TEMPMAXS table.

For more information, see TEMPMAXS and its Historical Note.

Definition

Figure 6.132. Query Defining the MIN_MAXS View


SELECT wreadings.wrid AS wrid
     , wreadings.wstation AS wstation
     , wreadings.wrdaytime AS wrdaytime
     , wreadings.estdaytime AS estdaytime
     , wreadings.wrperson AS wrperson
     , wreadings.wrnotes AS wrnotes
     , tempmins.tempmin AS tempmin
     , tempmaxs.tempmax AS tempmax
     , raingauges.rgspan AS rgspan
     , raingauges.estrgspan AS estrgspan
     , raingauges.rain AS rain
  FROM wreadings
       LEFT OUTER JOIN tempmins
            ON wreadings.wrid = tempmins.wrid
       LEFT OUTER JOIN tempmaxs
            ON wreadings.wrid = tempmaxs.wrid
       LEFT OUTER JOIN raingauges
            ON wreadings.wrid = raingauges.wrid
;


Figure 6.133. Entity Relationship Diagram of the MIN_MAXS View

If we could we would display here the diagram showing how the MIN_MAXS view is constructed.


Table 6.64. Columns in the MIN_MAXS View

Column From Description
WRid WREADINGS.WRid Identifier of the manual weather reading.
Wstation WREADINGS.Wstation Identifier of the weather station where the reading was taken.
WRdaytime WREADINGS.WRdaytime Date and time of the weather reading.
Estdaytime WREADINGS.Estdaytime Whether the WREADINGS.WRdaytime is estimated. TRUE if the date/time is estimated, FALSE if the reading was taken at a known date and time.
WRperson WREADINGS.WRperson The OBSERVERS.Initials of the person who took the reading.
WRnotes WREADINGS.WRnotes Textual notes on the weather reading.
Tempmin TEMPMINS.Tempmin The minimum temperature reading, if any, since the last minimum temperature reading at the weather station.
Tempmax TEMPMAXS.Tempmax The maximum temperature reading, if any, since the last maximum temperature reading at the weather station.
RGspan RAINGAUGES.RGspan The time elapsed since the rain gauge was last emptied.
EstRGspan RAINGAUGES.EstRGspan Weather or not the time elapsed since the rain gauge was last emptied is an estimate. TRUE when the elapsed time is based on one or more estimated times, FALSE when the elapsed time is computed from known endpoints.
Rain RAINGAUGES.Rain The amount of rain accumulation in millimeters.

Operations Allowed

INSERT

Inserting a row into MIN_MAXS inserts a row into WREADINGS and rows into TEMPMINS, TEMPMAXS, and RAINGAUGES as expected. Rows are only inserted into TEMPMINS, TEMPMAXS, and RAINGAUGES when the relevant columns are present and contain non-NULL values.

Warning

Attempts to specify the WRid column on insert are silently ignored. When inserting a new weather reading the WRid column should be unspecified (the column omitted or the data values specified as NULL). Babase automatically computes a WRid and uses it appropriately in the new rows.

Warning

The value of the RGspan and EstRGspan columns are ignored and automatically computed values are used in their place. It is best to omit these columns from the inserted data (or specify them as NULL).

Warning

The PostgreSQL nextval() function cannot be part of an INSERT expression which assigns a value to this view's Wrid column.

UPDATE

The MIN_MAXS view may not be updated.

DELETE

Deleting a row from MIN_MAXS deletes a row from WREADINGS and rows from TEMPMINS, TEMPMAXS, and RAINGAUGES as expected.

MIN_MAXS_SORTED (MIN_MAXS, Sorted)

Contains one row for every row in WREADINGS. This view is the MIN_MAXS view sorted for ease of maintenance.

This view is less efficient than MIN_MAXS like view.

Definition

Figure 6.134. Query Defining the MIN_MAXS_SORTED View


SELECT wreadings.wrid AS wrid
     , wreadings.wstation AS wstation
     , wreadings.wrdaytime AS wrdaytime
     , wreadings.estdaytime AS estdaytime
     , wreadings.wrperson AS wrperson
     , wreadings.wrnotes AS wrnotes
     , tempmins.tempmin AS tempmin
     , tempmaxs.tempmax AS tempmax
     , raingauges.rgspan AS rgspan
     , raingauges.estrgspan AS estrgspan
     , raingauges.rain AS rain
  FROM wreadings
       LEFT OUTER JOIN tempmins
            ON wreadings.wrid = tempmins.wrid
       LEFT OUTER JOIN tempmaxs
            ON wreadings.wrid = tempmaxs.wrid
       LEFT OUTER JOIN raingauges
            ON wreadings.wrid = raingauges.wrid
  ORDER BY wreadings.wrdaytime, wreadings.wstation;
;


Figure 6.135. Entity Relationship Diagram of the MIN_MAXS_SORTED View

If we could we would display here the diagram showing how the MIN_MAXS_SORTED view is constructed.


Table 6.65. Columns in the MIN_MAXS_SORTED View

Column From Description
WRid WREADINGS.WRid Identifier of the manual weather reading.
Wstation WREADINGS.Wstation Identifier of the weather station where the reading was taken.
WRdaytime WREADINGS.WRdaytime Date and time of the weather reading.
Estdaytime WREADINGS.Estdaytime Whether the WREADINGS.WRdaytime is estimated. TRUE if the date/time is estimated, FALSE if the reading was taken at a known date and time.
WRperson WREADINGS.WRperson The OBSERVERS.Initials of the person who took the reading.
WRnotes WREADINGS.WRnotes Textual notes on the weather reading.
Tempmin TEMPMINS.Tempmin The minimum temperature reading, if any, since the last minimum temperature reading at the weather station.
Tempmax TEMPMAXS.Tempmax The maximum temperature reading, if any, since the last maximum temperature reading at the weather station.
RGspan RAINGAUGES.RGspan The time elapsed since the rain gauge was last emptied.
EstRGspan RAINGAUGES.EstRGspan Weather or not the time elapsed since the rain gauge was last emptied is an estimate. TRUE when the elapsed time is based on one or more estimated times, FALSE when the elapsed time is computed from known endpoints.
Rain RAINGAUGES.Rain The amount of rain accumulation in millimeters.

Operations Allowed

The operations allowed are as described in the MIN_MAXS view.



[296] Because the MIN_MAXS view always returns a row regardless of whether data exists in TEMPMINS, TEMPMAXS, and RAINGAUGES the view may sometimes be less useful than, say, a query which returns only those rows where there is both a minimum and a maximum temperature reading. In other words, as usual, it's always prudent to know what you're doing when querying Babase.


Page generated: 2022-09-15T15:33:40-04:00.