Dimensions¶
DimensionModel¶
dsgrid.config.dimensions.DimensionModel
Defines a non-time dimension
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Registry database ID |
|
|
|
Version, generated by dsgrid |
|
|
(required) |
Dimension name |
|
(required) |
Type of the dimension |
|
|
|
|
Unique identifier, generated by dsgrid |
|
|
|
Python module with the dimension class |
|
|
(required) |
Dimension record model class name. The dimension class defines the expected and allowable fields (and their data types) for the dimension records file.All dimension records must have a ‘id’ and ‘name’ field.Some dimension classes support additional fields that can be used for mapping, querying, display, etc.dsgrid in online-mode only supports dimension classes defined in the :mod: |
|
|
|
Dimension record model class |
|
|
|
A description of the dimension records that is helpful, memorable, and identifiable |
|
|
|
Filename containing dimension records. Only assigned for user input and output purposes. The registry database stores records in the dimension JSON document. |
|
|
|
Hash of the contents of the file |
|
|
|
Dimension records that can either be loaded from filename at runtime or provided directly. Example of records provided directly: records: [ {id: ‘scenario_1’, name: ‘Scenario 1’}, {id: ‘scenario_2’, name: ‘Scenario 2’}, ], |
Validators¶
Name |
Applies To |
Description |
|---|---|---|
|
|
No description |
|
|
No description |
|
|
Set class_name based on inputs. |
|
|
No description |
|
|
Validate that dimension file exists and has no errors |
|
|
No description |
|
|
Add records from the file. |
DateTimeDimensionModel¶
dsgrid.config.dimensions.DateTimeDimensionModel
Defines a time dimension where timestamps translate to datetime objects.
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Registry database ID |
|
|
|
Version, generated by dsgrid |
|
|
(required) |
Dimension name |
|
(required) |
Type of the dimension |
|
|
|
|
Unique identifier, generated by dsgrid |
|
|
|
Python module with the dimension class |
|
|
(required) |
Dimension record model class name. The dimension class defines the expected and allowable fields (and their data types) for the dimension records file.All dimension records must have a ‘id’ and ‘name’ field.Some dimension classes support additional fields that can be used for mapping, querying, display, etc.dsgrid in online-mode only supports dimension classes defined in the :mod: |
|
|
|
Dimension record model class |
|
|
|
A description of the dimension records that is helpful, memorable, and identifiable |
|
|
Type of time dimension |
|
|
TimeFormatDateTimeTZModel | TimeFormatDateTimeNTZModel | TimeFormatInPartsModel |
|
Specifies the format of the timestamps in the dataset. |
|
(required) |
Specifies whether timestamps are aligned in absolute time or in local standard time when adjusted for time zone. |
|
|
|
The type of measurement represented by a value associated with a timestamp: mean, min, max, measured, total |
|
|
list[TimeRangeModel] |
(required) |
Defines the continuous ranges of datetime in the data, inclusive of start and end time. |
|
(required) |
The range of time that the value associated with a timestamp represents, e.g., period-beginning |
Validators¶
Name |
Applies To |
Description |
|---|---|---|
|
|
No description |
|
|
No description |
|
|
Set class_name based on inputs. |
|
|
No description |
|
|
No description |
|
|
No description |
|
|
Validate that only fixed-offset time zones are used when localizing tz-naive timestamps. |
AlignedTimeSingleTimeZone¶
dsgrid.config.dimensions.AlignedTimeSingleTimeZone
All geographies have data with the same set of timestamps in absolute time.
E.g., data in CA and NY both start in 2018-01-01 00:00 Etc/GMT+5 (EST).
For time zone, only an IANA time zone name or None is accepted. The types of time zones supported (fixed offset or DST-observing) depend on column_format, which in part defines whether the timestamps are tz-naive after parsing:
When the input timestamps are tz-aware, both fixed offset or DST-observing time zones (“America/New_York”) are accepted.
When the input timestamps are tz-naive (i.e., ‘timestamp_ntz’ or TimeFormatInParts without offset column), only IANA time zones with constant UTC offsets (e.g., “Etc/GMT+5”) are allowed because dsgrid will localize the tz-naive timestamps to the time zone specified here. By definition, the timestamps in the data table must also be in standard time without skips and duplicates for daylight saving time (DST). This restriction is necessary to avoid ambiguous or missing timestamps at DST transitions when localizing tz-naive timestamps.
Note: IANA time zone names (e.g., “America/New_York”, “Etc/GMT+5”) are distinct from UTC offsets (e.g., UTC-5). Fixed-offset zones like “Etc/GMT+5” observe a single UTC offset (UTC-5) year-round, while DST-observing zones like “America/New_York” have multiple offsets depending on the calendar date (UTC-5 during standard time, UTC-4 during daylight saving time).
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
|
|
|
(required) |
IANA time zone of data. Accepts |
Validators¶
Name |
Applies To |
Description |
|---|---|---|
|
|
No description |
LocalTimeMultipleTimeZones¶
dsgrid.config.dimensions.LocalTimeMultipleTimeZones
Timestamps cover the same interval of local clock time across geographies.
All data represents the same interval of standard clock time as experienced locally in each geography’s time zone, but the intervals represent different absolute UTC instants.
Example: California data starts at 2018-01-01 00:00-08:00, while New York data starts at 2018-01-01 00:00-05:00. Both rows have the same local clock time but represent different absolute UTC instants.
The data table must contain a time_zone column with IANA time zone names
(one per row) that match the entries in the time_zones list below. The types of of time
zones supported (fixed offset or DST-observing) depend on column_format, which in part defines
whether the timestamps are tz-naive after parsing:
When the input timestamps are tz-aware, both fixed offset or DST-observing time zones (“America/New_York”) are accepted.
When the input timestamps are tz-naive (i.e., ‘timestamp_ntz’ or TimeFormatInParts without offset column), only IANA time zones with constant UTC offsets (e.g., “Etc/GMT+5”) are allowed because dsgrid will localize the tz-naive timestamps to the time zone specified here. By definition, the timestamps in the data table must also be in standard time without skips and duplicates for daylight saving time (DST). This restriction is necessary to avoid ambiguous or missing timestamps at DST transitions when localizing tz-naive timestamps.
Note: IANA time zone names (e.g., “America/New_York”, “Etc/GMT+5”) are distinct from UTC offsets (e.g., UTC-5). Fixed-offset zones like “Etc/GMT+5” observe a single UTC offset (UTC-5) year-round, while DST-observing zones like “America/New_York” have multiple offsets depending on the calendar date (UTC-5 during standard time, UTC-4 during daylight saving time).
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
|
|
list[ |
(required) |
List of unique IANA time zones in the dataset. Does not allow |
TimeFormatDateTimeNTZModel¶
dsgrid.config.dimensions.TimeFormatDateTimeNTZModel
Format of timestamps in a dataset is timezone-naive datetime
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
|
|
|
|
Name of the timestamp column in the dataset. |
Validators¶
Name |
Applies To |
Description |
|---|---|---|
|
|
No description |
TimeFormatDateTimeTZModel¶
dsgrid.config.dimensions.TimeFormatDateTimeTZModel
Format of timestamps in a dataset is timezone-aware datetime.
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
|
|
|
|
Name of the timestamp column in the dataset. |
Validators¶
Name |
Applies To |
Description |
|---|---|---|
|
|
No description |
TimeFormatInPartsModel¶
dsgrid.config.dimensions.TimeFormatInPartsModel
Format of timestamps in a dataset is in parts, e.g., month-day-hour format, requiring conversion to datetime.
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
|
|
|
(required) |
Name of the year column in the dataset. |
|
|
(required) |
Name of the month column in the dataset. Value is the month in a year (1 - 12) |
|
|
(required) |
Name of the day column in the dataset. Value is the day in a month (1 - 31). |
|
|
|
Name of the hour column in the dataset. Value is the hour in a day (0 - 23). If None, the hour will be set to 0 for all rows. |
|
|
|
Name of the offset column in the dataset. Value is the UTC offset, either as a numeric offset in hours (e.g., -8) or as a string in ±HH:MM format (e.g., -08:00). If None, no offset is applied and the resulting timestamp will be timezone-naive. Example: ‘2024-01-01 00:00:00-05:00’ is the start of 2024 in New York; the offset column records ‘-05:00’ for that row. For America/New_York, the offset is -05:00 during standard time and -04:00 during daylight saving time. |
TimeRangeModel¶
dsgrid.config.dimensions.TimeRangeModel
Defines a continuous range of time.
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
(required) |
First timestamp in the data |
|
|
(required) |
Last timestamp in the data (inclusive) |
|
|
|
Timestamp string format (for parsing the time ranges). The string format is used to parse the timestamps provided in the time ranges.Cheatsheet reference: |
|
|
|
Resolution of the timestamps |
AnnualTimeDimensionModel¶
dsgrid.config.dimensions.AnnualTimeDimensionModel
Defines an annual time dimension where timestamps are years. Each value associated with a year represents the MEASUREMENT_TYPE over the entire year. i.e., MEASUREMENT_TYPE = total means the value is the total over the year, not over the range frequency.
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Registry database ID |
|
|
|
Version, generated by dsgrid |
|
|
(required) |
Dimension name |
|
(required) |
Type of the dimension |
|
|
|
|
Unique identifier, generated by dsgrid |
|
|
|
Python module with the dimension class |
|
|
(required) |
Dimension record model class name. The dimension class defines the expected and allowable fields (and their data types) for the dimension records file.All dimension records must have a ‘id’ and ‘name’ field.Some dimension classes support additional fields that can be used for mapping, querying, display, etc.dsgrid in online-mode only supports dimension classes defined in the :mod: |
|
|
|
Dimension record model class |
|
|
|
A description of the dimension records that is helpful, memorable, and identifiable |
|
|
||
|
|
The type of measurement represented by a value associated with an annual time: e.g., total |
|
|
list[AnnualRangeModel] |
|
Defines the contiguous ranges of annual time in the data, inclusive of start and end time. |
|
|
|
Whether annual time includes leap day. |
Validators¶
Name |
Applies To |
Description |
|---|---|---|
|
|
No description |
|
|
No description |
|
|
Set class_name based on inputs. |
|
|
No description |
|
|
No description |
|
|
No description |
|
|
No description |
AnnualRangeModel¶
dsgrid.config.dimensions.AnnualRangeModel
Defines a continuous range of annual time.
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
(required) |
First year in the data |
|
|
(required) |
Last year in the data (inclusive) |
|
|
|
Timestamp string format. The string format is used to parse the timestamps provided in the time ranges. Cheatsheet reference: |
|
|
|
Resolution of the annual time in number of years |
RepresentativePeriodTimeDimensionModel¶
dsgrid.config.dimensions.RepresentativePeriodTimeDimensionModel
Defines a representative time dimension.
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Registry database ID |
|
|
|
Version, generated by dsgrid |
|
|
(required) |
Dimension name |
|
(required) |
Type of the dimension |
|
|
|
|
Unique identifier, generated by dsgrid |
|
|
|
Python module with the dimension class |
|
|
(required) |
Dimension record model class name. The dimension class defines the expected and allowable fields (and their data types) for the dimension records file.All dimension records must have a ‘id’ and ‘name’ field.Some dimension classes support additional fields that can be used for mapping, querying, display, etc.dsgrid in online-mode only supports dimension classes defined in the :mod: |
|
|
|
Dimension record model class |
|
|
|
A description of the dimension records that is helpful, memorable, and identifiable |
|
|
||
|
|
The type of measurement represented by a value associated with a timestamp: e.g., mean, total |
|
|
(required) |
Format of the timestamps in the load data |
|
|
list[MonthRangeModel] |
(required) |
Defines the continuous ranges of datetime in the data, inclusive of start and end time. |
|
(required) |
The range of time that the value associated with a timestamp represents |
Validators¶
Name |
Applies To |
Description |
|---|---|---|
|
|
No description |
|
|
No description |
|
|
Set class_name based on inputs. |
|
|
No description |
MonthRangeModel¶
dsgrid.config.dimensions.MonthRangeModel
Defines a continuous range of time.
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
(required) |
First month in the data (January is 1, December is 12) |
|
|
(required) |
Last month in the data (inclusive) |
IndexTimeDimensionModel¶
dsgrid.config.dimensions.IndexTimeDimensionModel
Defines a time dimension where timestamps are indices and requires converting to datetime.
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Registry database ID |
|
|
|
Version, generated by dsgrid |
|
|
(required) |
Dimension name |
|
(required) |
Type of the dimension |
|
|
|
|
Unique identifier, generated by dsgrid |
|
|
|
Python module with the dimension class |
|
|
(required) |
Dimension record model class name. The dimension class defines the expected and allowable fields (and their data types) for the dimension records file.All dimension records must have a ‘id’ and ‘name’ field.Some dimension classes support additional fields that can be used for mapping, querying, display, etc.dsgrid in online-mode only supports dimension classes defined in the :mod: |
|
|
|
Dimension record model class |
|
|
|
A description of the dimension records that is helpful, memorable, and identifiable |
|
|
||
|
|
The type of measurement represented by a value associated with a timestamp: e.g., mean, total |
|
|
list[IndexRangeModel] |
(required) |
Defines the continuous ranges of indices of the data, inclusive of start and end index. |
|
(required) |
The range of time that the value associated with a timestamp represents, e.g., period-beginning |
Validators¶
Name |
Applies To |
Description |
|---|---|---|
|
|
No description |
|
|
No description |
|
|
Set class_name based on inputs. |
|
|
No description |
|
|
No description |
|
|
No description |
IndexRangeModel¶
dsgrid.config.dimensions.IndexRangeModel
Defines a continuous range of indices.
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
(required) |
First of indices |
|
|
(required) |
Last of indices (inclusive) |
|
|
(required) |
Timestamp the start index corresponds to. |
|
|
|
Timestamp string format. The string format is used to parse the starting timestamp provided. Cheatsheet reference: |
|
|
|
Resolution of the timestamps for which the index range represents. |
NoOpTimeDimensionModel¶
dsgrid.config.dimensions.NoOpTimeDimensionModel
Defines a NoOp time dimension.
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Registry database ID |
|
|
|
Version, generated by dsgrid |
|
|
(required) |
Dimension name |
|
(required) |
Type of the dimension |
|
|
|
|
Unique identifier, generated by dsgrid |
|
|
|
Python module with the dimension class |
|
|
(required) |
Dimension record model class name. The dimension class defines the expected and allowable fields (and their data types) for the dimension records file.All dimension records must have a ‘id’ and ‘name’ field.Some dimension classes support additional fields that can be used for mapping, querying, display, etc.dsgrid in online-mode only supports dimension classes defined in the :mod: |
|
|
|
Dimension record model class |
|
|
|
A description of the dimension records that is helpful, memorable, and identifiable |
|
|
Validators¶
Name |
Applies To |
Description |
|---|---|---|
|
|
No description |
|
|
No description |
|
|
Set class_name based on inputs. |
|
|
No description |
DimensionReferenceModel¶
dsgrid.config.dimensions.DimensionReferenceModel
Reference to a dimension stored in the registry
Fields¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
(required) |
Type of the dimension |
|
|
|
(required) |
Unique ID of the dimension in the registry. The dimension ID is generated by dsgrid when a dimension is registered. Only alphanumerics and dashes are supported. |
|
|
(required) |
Version of the dimension. The version string must be in semver format (e.g., ‘1.0.0’) and it must be a valid/existing version in the registry. |