noaa_api.json_schemas
JSON Schema Definitions for NOAA API Responses
This module defines TypedDict structures that represent the JSON responses from the NOAA NCEI API v2. The schemas ensure type safety and provide clear documentation on the expected structure of API responses.
Each class corresponds to a specific API endpoint, describing the structure of the JSON data returned by that endpoint.
Motivations:
Type Safety:
- Prevents runtime errors by catching type mismatches during development
- Enables IDE autocompletion and inline documentation
- Makes refactoring safer by identifying all affected code paths
Documentation as Code:
- Schema definitions serve as both runtime type checking and API documentation
- Field descriptions are always in sync with the actual implementation
- New developers can understand the API structure by reading the type definitions
Error Prevention:
- Catches common issues like missing required fields
- Validates data types before processing (e.g., numeric vs string fields)
- Helps prevent data processing errors due to unexpected field formats
API Evolution:
- Tracks API changes through type definitions
- Makes breaking changes obvious through type checking
- Facilitates versioning and backward compatibility
Implementation Notes:
Field Types:
- Date fields use string type with format annotations (e.g., 'YYYY-MM-DD')
- Numeric fields accept both float and int for maximum compatibility
- Optional fields are marked with
NotRequiredto handle varying responses
Response Structure:
- All list endpoints include
metadatawith pagination info - Single-item endpoints (e.g.,
/datasets/{id}) return direct objects - Rate limit responses have a distinct schema for error handling
- All list endpoints include
Data Handling:
- Some numeric fields (e.g., 'datacoverage') may be returned as strings
- Geographic coordinates are always numeric (float or int)
- Empty or null values should be handled appropriately in client code
Best Practices:
- Always validate response structure against these schemas
- Handle optional fields defensively
- Consider caching metadata responses
- Check for rate limit responses before processing data
Schemas:
ResultSetJSON: Metadata about pagination (offset, count, limit).MetadataJSON: EncapsulatesResultSetJSON, included in most responses.RateLimitJSON: Response for rate-limiting errors.DatasetIDJSON: Response schema for/datasets/{id}.DatasetsJSON: Response schema for/datasets.DatacategoryIDJSON: Response schema for/datacategories/{id}.DatacategoriesJSON: Response schema for/datacategories.DatatypeIDJSON: Response schema for/datatypes/{id}.DatatypesJSON: Response schema for/datatypes.LocationcategoryIDJSON: Response schema for/locationcategories/{id}.LocationcategoriesJSON: Response schema for/locationcategories.LocationIDJSON: Response schema for/locations/{id}.LocationsJSON: Response schema for/locations.StationIDJSON: Response schema for/stations/{id}.StationsJSON: Response schema for/stations.DatapointJSON: Individual data point response fromdata?datasetid=....DataJSON: Response schema fordata?datasetid=....
Notes:
- Some fields, such as dates, follow a specific format (
YYYY-MM-DDorYYYY-MM-DDTHH:MM:SS). - Certain fields are
NotRequired, meaning they may not appear in all responses. - Data coverage fields (
datacoverage) are expressed as a float or integer. - Geographic coordinates (latitude, longitude) are always numeric but may be integer or float.
- Station elevation values include both the numeric value and unit of measurement.
- Data point values may include quality flags in the optional attributes field.
These schemas facilitate type checking and autocompletion in IDEs while working with the NOAA API responses.
1""" 2JSON Schema Definitions for NOAA API Responses 3============================================== 4 5This module defines `TypedDict` structures that represent the JSON responses from the NOAA NCEI API v2. The schemas ensure type safety and provide clear documentation on the expected structure of API responses. 6 7Each class corresponds to a specific API endpoint, describing the structure of the JSON data returned by that endpoint. 8 9Motivations: 10----------- 111. **Type Safety**: 12 - Prevents runtime errors by catching type mismatches during development 13 - Enables IDE autocompletion and inline documentation 14 - Makes refactoring safer by identifying all affected code paths 15 162. **Documentation as Code**: 17 - Schema definitions serve as both runtime type checking and API documentation 18 - Field descriptions are always in sync with the actual implementation 19 - New developers can understand the API structure by reading the type definitions 20 213. **Error Prevention**: 22 - Catches common issues like missing required fields 23 - Validates data types before processing (e.g., numeric vs string fields) 24 - Helps prevent data processing errors due to unexpected field formats 25 264. **API Evolution**: 27 - Tracks API changes through type definitions 28 - Makes breaking changes obvious through type checking 29 - Facilitates versioning and backward compatibility 30 31Implementation Notes: 32------------------- 331. **Field Types**: 34 - Date fields use string type with format annotations (e.g., 'YYYY-MM-DD') 35 - Numeric fields accept both float and int for maximum compatibility 36 - Optional fields are marked with `NotRequired` to handle varying responses 37 382. **Response Structure**: 39 - All list endpoints include `metadata` with pagination info 40 - Single-item endpoints (e.g., `/datasets/{id}`) return direct objects 41 - Rate limit responses have a distinct schema for error handling 42 433. **Data Handling**: 44 - Some numeric fields (e.g., 'datacoverage') may be returned as strings 45 - Geographic coordinates are always numeric (float or int) 46 - Empty or null values should be handled appropriately in client code 47 484. **Best Practices**: 49 - Always validate response structure against these schemas 50 - Handle optional fields defensively 51 - Consider caching metadata responses 52 - Check for rate limit responses before processing data 53 54Schemas: 55-------- 56 - `ResultSetJSON`: Metadata about pagination (offset, count, limit). 57 - `MetadataJSON`: Encapsulates `ResultSetJSON`, included in most responses. 58 - `RateLimitJSON`: Response for rate-limiting errors. 59 - `DatasetIDJSON`: Response schema for `/datasets/{id}`. 60 - `DatasetsJSON`: Response schema for `/datasets`. 61 - `DatacategoryIDJSON`: Response schema for `/datacategories/{id}`. 62 - `DatacategoriesJSON`: Response schema for `/datacategories`. 63 - `DatatypeIDJSON`: Response schema for `/datatypes/{id}`. 64 - `DatatypesJSON`: Response schema for `/datatypes`. 65 - `LocationcategoryIDJSON`: Response schema for `/locationcategories/{id}`. 66 - `LocationcategoriesJSON`: Response schema for `/locationcategories`. 67 - `LocationIDJSON`: Response schema for `/locations/{id}`. 68 - `LocationsJSON`: Response schema for `/locations`. 69 - `StationIDJSON`: Response schema for `/stations/{id}`. 70 - `StationsJSON`: Response schema for `/stations`. 71 - `DatapointJSON`: Individual data point response from `data?datasetid=...`. 72 - `DataJSON`: Response schema for `data?datasetid=...`. 73 74Notes: 75------ 76 - Some fields, such as dates, follow a specific format (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SS`). 77 - Certain fields are `NotRequired`, meaning they may not appear in all responses. 78 - Data coverage fields (`datacoverage`) are expressed as a float or integer. 79 - Geographic coordinates (latitude, longitude) are always numeric but may be integer or float. 80 - Station elevation values include both the numeric value and unit of measurement. 81 - Data point values may include quality flags in the optional attributes field. 82 83These schemas facilitate type checking and autocompletion in IDEs while working with the NOAA API responses. 84""" # noqa: E501 85 86from typing import NotRequired, TypedDict 87 88 89class ResultSetJSON(TypedDict): 90 """ 91 Represents metadata about the result set, including pagination details. 92 """ # noqa: E501 93 94 offset: int 95 """ 96 The starting point of the returned results. 97 """ # noqa: E501 98 99 count: int 100 """ 101 The total number of results available. 102 """ # noqa: E501 103 104 limit: int 105 """ 106 The maximum number of results returned per request. 107 """ # noqa: E501 108 109 110# --- Full JSON Response Structure --- 111class MetadataJSON(TypedDict): 112 """ 113 Contains metadata information for a response, including result set details. 114 """ # noqa: E501 115 116 resultset: ResultSetJSON 117 """ 118 Pagination and count details of the results. 119 """ # noqa: E501 120 121 122# Rate limit json reponse 123class RateLimitJSON(TypedDict): 124 """ 125 Represents the JSON response structure for rate limit information. 126 """ # noqa: E501 127 128 status: str 129 """ 130 The status of the rate limit (e.g., 'error'). 131 """ # noqa: E501 132 133 message: str 134 """ 135 A descriptive message regarding the rate limit status. 136 """ # noqa: E501 137 138 139# Endpoint '/datasets/{id}' 140 141 142# --- Full JSON Response Structure --- 143class DatasetIDJSON(TypedDict): 144 """ 145 Endpoint '/datasets/{id}' 146 Represents the JSON response structure for a specific dataset identified by its ID. 147 """ # noqa: E501 148 149 mindate: str # Date as "YYYY-MM-DD" 150 """ 151 The earliest date for which data is available, formatted as 'YYYY-MM-DD'. 152 """ 153 154 maxdate: str # Date as "YYYY-MM-DD" 155 """ 156 The latest date for which data is available, formatted as 'YYYY-MM-DD'. 157 """ 158 159 name: str 160 """ 161 The name of the dataset. 162 """ 163 164 datacoverage: float | int 165 """ 166 The proportion of data coverage, ranging from 0 to 1. 167 """ 168 169 id: str 170 """ 171 The unique identifier for the dataset. 172 """ 173 174 175# Endpoint '/datasets' 176 177 178class DatasetJSON(TypedDict): 179 """ 180 Endpoint '/datasets' (subcomponent) 181 Represents a dataset within the '/datasets' endpoint response. (subcomponent) 182 """ # noqa: E501 183 184 uid: str 185 """ 186 The unique identifier for the dataset. 187 """ 188 189 mindate: str # Date as "YYYY-MM-DD" 190 """ 191 The earliest date for which data is available, formatted as 'YYYY-MM-DD'. 192 """ 193 194 maxdate: str # Date as "YYYY-MM-DD" 195 """ 196 The latest date for which data is available, formatted as 'YYYY-MM-DD'. 197 """ 198 199 name: str 200 """ 201 The name of the dataset. 202 """ 203 204 datacoverage: float | int 205 """ 206 The proportion of data coverage, ranging from 0 to 1. 207 """ 208 209 id: str 210 """ 211 The unique identifier for the dataset. 212 """ 213 214 215# --- Full JSON Response Structure --- 216class DatasetsJSON(TypedDict): 217 """ 218 Endpoint '/datasets' 219 Represents the JSON response structure for the '/datasets' endpoint. 220 """ # noqa: E501 221 222 metadata: MetadataJSON 223 """ 224 Metadata information about the response. 225 """ 226 227 results: list[DatasetJSON] 228 """ 229 A list of datasets returned in the response. 230 """ 231 232 233# Endpoint '/datacategories/{id}' 234 235 236class DatacategoryIDJSON(TypedDict): 237 """ 238 Endpoint '/datacategories/{id}' 239 Represents the JSON response structure for a specific data category identified by its ID. 240 """ # noqa: E501 241 242 name: str 243 """ 244 The name of the data category. 245 """ 246 247 id: str 248 """ 249 The unique identifier for the data category. 250 """ 251 252 253# Endpoint '/datacategories' 254 255 256class DatacategoriesJSON(TypedDict): 257 """ 258 Endpoint '/datacategories' 259 Represents the JSON response structure for the '/datacategories' endpoint. 260 """ # noqa: E501 261 262 metadata: MetadataJSON 263 """ 264 Metadata information about the response. 265 """ 266 267 results: list[DatacategoryIDJSON] 268 """ 269 A list of data categories returned in the response. 270 """ 271 272 273# Endpoint '/datatypes/{id}' 274 275 276class DatatypeIDJSON(TypedDict): 277 """ 278 Endpoint '/datatypes/{id}' 279 Represents the JSON response structure for a specific data type identified by its ID. 280 """ # noqa: E501 281 282 mindate: str # Date as "YYYY-MM-DD" 283 """ 284 The earliest date for which the data type is available, formatted as 'YYYY-MM-DD'. 285 """ 286 287 maxdate: str # Date as "YYYY-MM-DD" 288 """ 289 The latest date for which the data type is available, formatted as 'YYYY-MM-DD'. 290 """ 291 292 datacoverage: float | int 293 """ 294 The proportion of data coverage for the data type. 295 """ 296 297 id: str 298 """ 299 The unique identifier for the data type. 300 """ 301 302 303# Endpoint '/datatypes' 304 305 306class DatatypeJSON(TypedDict): 307 """ 308 Endpoint '/datatypes' 309 Represents a data type within the '/datatypes' endpoint response. (subcomponent) 310 """ # noqa: E501 311 312 mindate: str # Date as "YYYY-MM-DD" 313 """ 314 The earliest date for which the data type is available, formatted as 'YYYY-MM-DD'. 315 """ 316 317 maxdate: str # Date as "YYYY-MM-DD" 318 """ 319 The latest date for which the data type is available, formatted as 'YYYY-MM-DD'. 320 """ 321 322 name: str 323 """ 324 The name of the data type. 325 """ 326 327 datacoverage: float | int 328 """ 329 The proportion of data coverage for the data type. 330 """ 331 332 id: str 333 """ 334 The unique identifier for the data type. 335 """ 336 337 338class DatatypesJSON(TypedDict): 339 """ 340 Endpoint '/datatypes' 341 Represents the JSON response structure for the '/datatypes' endpoint. 342 """ # noqa: E501 343 344 metadata: MetadataJSON 345 """ 346 Metadata information about the response. 347 """ 348 349 results: list[DatatypeJSON] 350 """ 351 A list of data types returned in the response. 352 """ 353 354 355# Endpoint '/locationcategories/{id}' 356 357 358class LocationcategoryIDJSON(TypedDict): 359 """ 360 Endpoint '/locationcategories/{id}' 361 Represents the JSON response structure for a specific location category identified by its ID. 362 """ # noqa: E501 363 364 name: str 365 """ 366 The name of the location category. 367 """ 368 369 id: str 370 """ 371 The unique identifier for the location category. 372 """ 373 374 375# Endpoint '/locationcategories' 376 377 378class LocationcategoriesJSON(TypedDict): 379 """ 380 Endpoint '/locationcategories' 381 Represents the JSON response structure for the '/locationcategories' endpoint. 382 """ # noqa: E501 383 384 metadata: MetadataJSON 385 """ 386 Metadata information about the response. 387 """ 388 389 results: list[LocationcategoryIDJSON] 390 """ 391 A list of location categories returned in the response. 392 """ 393 394 395# Endpoint '/locations/{id}' 396 397 398class LocationIDJSON(TypedDict): 399 """ 400 Endpoint '/locations/{id}' 401 Represents the JSON response structure for a specific location identified by its ID. 402 """ # noqa: E501 403 404 mindate: str # Date as "YYYY-MM-DD" 405 """ 406 The earliest date for which data is available for the location, formatted as 'YYYY-MM-DD'. 407 """ # noqa: E501 408 409 maxdate: str # Date as "YYYY-MM-DD" 410 """ 411 The latest date for which data is available for the location, formatted as 'YYYY-MM-DD'. 412 """ # noqa: E501 413 414 name: str 415 """ 416 The name of the location. 417 """ 418 419 datacoverage: float | int 420 """ 421 The proportion of data coverage for the location. 422 """ 423 424 id: str 425 """ 426 The unique identifier for the location. 427 """ 428 429 430# Endpoint '/locations' 431 432 433class LocationsJSON(TypedDict): 434 """ 435 Endpoint '/locations' 436 Represents the JSON response structure for the '/locations' endpoint. 437 """ # noqa: E501 438 439 metadata: MetadataJSON 440 """ 441 Metadata information about the response, including pagination details. 442 """ 443 444 results: list[LocationIDJSON] 445 """ 446 A list of location records returned by the query. 447 """ 448 449 450# Endpoint '/stations/{id}' 451 452 453class StationIDJSON(TypedDict): 454 """ 455 Endpoint '/stations/{id}' 456 Represents the JSON response structure for a specific station identified by its ID from the '/stations/{id}' endpoint. 457 """ # noqa: E501 458 459 elevation: int | float 460 """ 461 The elevation of the station in meters. 462 """ 463 464 mindate: str # Date as "YYYY-MM-DD" 465 """ 466 The earliest date for which data is available, formatted as 'YYYY-MM-DD'. 467 """ 468 469 maxdate: str # Date as "YYYY-MM-DD" 470 """ 471 The latest date for which data is available, formatted as 'YYYY-MM-DD'. 472 """ 473 474 latitude: float | int 475 """ 476 The latitude coordinate of the station. 477 """ 478 479 name: str 480 """ 481 The name of the station. 482 """ 483 484 datacoverage: float | int 485 """ 486 The proportion of data coverage, ranging from 0 to 1. 487 """ 488 489 id: str 490 """ 491 The unique identifier for the station. 492 """ 493 494 elevationUnit: str 495 """ 496 The unit of measurement for elevation (e.g., 'METERS'). 497 """ 498 499 longitude: float | int 500 """ 501 The longitude coordinate of the station. 502 """ 503 504 505# Endpoint '/stations' 506 507 508class StationsJSON(TypedDict): 509 """ 510 Endpoint '/stations' 511 Represents the JSON response structure for the '/stations' endpoint. 512 """ # noqa: E501 513 514 metadata: MetadataJSON 515 """ 516 Metadata information about the response, including pagination details. 517 """ 518 519 results: list[StationIDJSON] 520 """ 521 A list of station records returned by the query. 522 """ 523 524 525# Endpoint 'data?datasetid=YOUR_DATASETID' 526 527 528class DatapointJSON(TypedDict): 529 """ 530 Endpoint '/data?datasetid=YOUR_DATASETID' (subcomponent) 531 Represents a single data point in the response from the 'data?datasetid=YOUR_DATASETID' endpoint. (subcomponent) 532 """ # noqa: E501 533 534 date: str # Date as "YYYY-MM-DDTHH:MM:SS" 535 """ 536 The date and time of the observation, formatted as 'YYYY-MM-DDTHH:MM:SS'. 537 """ 538 539 datatype: str 540 """ 541 The type of data recorded (e.g., temperature, precipitation). 542 """ 543 544 station: str 545 """ 546 The identifier of the station where the data was recorded. 547 """ 548 549 attributes: NotRequired[str] 550 """ 551 Additional attributes or flags associated with the data point. 552 """ 553 554 value: float | int 555 """ 556 The recorded value of the data point. 557 """ 558 559 560class DataJSON(TypedDict): 561 """ 562 Endpoint '/data?datasetid=YOUR_DATASETID' 563 Represents the full JSON response structure for the '/data?datasetid=YOUR_DATASETID' endpoint. 564 """ # noqa: E501 565 566 metadata: MetadataJSON 567 """ 568 Metadata information about the response, including pagination details. 569 """ 570 571 results: list[DatapointJSON] 572 """ 573 A list of data points returned by the query. 574 """
90class ResultSetJSON(TypedDict): 91 """ 92 Represents metadata about the result set, including pagination details. 93 """ # noqa: E501 94 95 offset: int 96 """ 97 The starting point of the returned results. 98 """ # noqa: E501 99 100 count: int 101 """ 102 The total number of results available. 103 """ # noqa: E501 104 105 limit: int 106 """ 107 The maximum number of results returned per request. 108 """ # noqa: E501
Represents metadata about the result set, including pagination details.
112class MetadataJSON(TypedDict): 113 """ 114 Contains metadata information for a response, including result set details. 115 """ # noqa: E501 116 117 resultset: ResultSetJSON 118 """ 119 Pagination and count details of the results. 120 """ # noqa: E501
Contains metadata information for a response, including result set details.
124class RateLimitJSON(TypedDict): 125 """ 126 Represents the JSON response structure for rate limit information. 127 """ # noqa: E501 128 129 status: str 130 """ 131 The status of the rate limit (e.g., 'error'). 132 """ # noqa: E501 133 134 message: str 135 """ 136 A descriptive message regarding the rate limit status. 137 """ # noqa: E501
Represents the JSON response structure for rate limit information.
144class DatasetIDJSON(TypedDict): 145 """ 146 Endpoint '/datasets/{id}' 147 Represents the JSON response structure for a specific dataset identified by its ID. 148 """ # noqa: E501 149 150 mindate: str # Date as "YYYY-MM-DD" 151 """ 152 The earliest date for which data is available, formatted as 'YYYY-MM-DD'. 153 """ 154 155 maxdate: str # Date as "YYYY-MM-DD" 156 """ 157 The latest date for which data is available, formatted as 'YYYY-MM-DD'. 158 """ 159 160 name: str 161 """ 162 The name of the dataset. 163 """ 164 165 datacoverage: float | int 166 """ 167 The proportion of data coverage, ranging from 0 to 1. 168 """ 169 170 id: str 171 """ 172 The unique identifier for the dataset. 173 """
Endpoint '/datasets/{id}' Represents the JSON response structure for a specific dataset identified by its ID.
179class DatasetJSON(TypedDict): 180 """ 181 Endpoint '/datasets' (subcomponent) 182 Represents a dataset within the '/datasets' endpoint response. (subcomponent) 183 """ # noqa: E501 184 185 uid: str 186 """ 187 The unique identifier for the dataset. 188 """ 189 190 mindate: str # Date as "YYYY-MM-DD" 191 """ 192 The earliest date for which data is available, formatted as 'YYYY-MM-DD'. 193 """ 194 195 maxdate: str # Date as "YYYY-MM-DD" 196 """ 197 The latest date for which data is available, formatted as 'YYYY-MM-DD'. 198 """ 199 200 name: str 201 """ 202 The name of the dataset. 203 """ 204 205 datacoverage: float | int 206 """ 207 The proportion of data coverage, ranging from 0 to 1. 208 """ 209 210 id: str 211 """ 212 The unique identifier for the dataset. 213 """
Endpoint '/datasets' (subcomponent) Represents a dataset within the '/datasets' endpoint response. (subcomponent)
217class DatasetsJSON(TypedDict): 218 """ 219 Endpoint '/datasets' 220 Represents the JSON response structure for the '/datasets' endpoint. 221 """ # noqa: E501 222 223 metadata: MetadataJSON 224 """ 225 Metadata information about the response. 226 """ 227 228 results: list[DatasetJSON] 229 """ 230 A list of datasets returned in the response. 231 """
Endpoint '/datasets' Represents the JSON response structure for the '/datasets' endpoint.
237class DatacategoryIDJSON(TypedDict): 238 """ 239 Endpoint '/datacategories/{id}' 240 Represents the JSON response structure for a specific data category identified by its ID. 241 """ # noqa: E501 242 243 name: str 244 """ 245 The name of the data category. 246 """ 247 248 id: str 249 """ 250 The unique identifier for the data category. 251 """
Endpoint '/datacategories/{id}' Represents the JSON response structure for a specific data category identified by its ID.
257class DatacategoriesJSON(TypedDict): 258 """ 259 Endpoint '/datacategories' 260 Represents the JSON response structure for the '/datacategories' endpoint. 261 """ # noqa: E501 262 263 metadata: MetadataJSON 264 """ 265 Metadata information about the response. 266 """ 267 268 results: list[DatacategoryIDJSON] 269 """ 270 A list of data categories returned in the response. 271 """
Endpoint '/datacategories' Represents the JSON response structure for the '/datacategories' endpoint.
277class DatatypeIDJSON(TypedDict): 278 """ 279 Endpoint '/datatypes/{id}' 280 Represents the JSON response structure for a specific data type identified by its ID. 281 """ # noqa: E501 282 283 mindate: str # Date as "YYYY-MM-DD" 284 """ 285 The earliest date for which the data type is available, formatted as 'YYYY-MM-DD'. 286 """ 287 288 maxdate: str # Date as "YYYY-MM-DD" 289 """ 290 The latest date for which the data type is available, formatted as 'YYYY-MM-DD'. 291 """ 292 293 datacoverage: float | int 294 """ 295 The proportion of data coverage for the data type. 296 """ 297 298 id: str 299 """ 300 The unique identifier for the data type. 301 """
Endpoint '/datatypes/{id}' Represents the JSON response structure for a specific data type identified by its ID.
307class DatatypeJSON(TypedDict): 308 """ 309 Endpoint '/datatypes' 310 Represents a data type within the '/datatypes' endpoint response. (subcomponent) 311 """ # noqa: E501 312 313 mindate: str # Date as "YYYY-MM-DD" 314 """ 315 The earliest date for which the data type is available, formatted as 'YYYY-MM-DD'. 316 """ 317 318 maxdate: str # Date as "YYYY-MM-DD" 319 """ 320 The latest date for which the data type is available, formatted as 'YYYY-MM-DD'. 321 """ 322 323 name: str 324 """ 325 The name of the data type. 326 """ 327 328 datacoverage: float | int 329 """ 330 The proportion of data coverage for the data type. 331 """ 332 333 id: str 334 """ 335 The unique identifier for the data type. 336 """
Endpoint '/datatypes' Represents a data type within the '/datatypes' endpoint response. (subcomponent)
339class DatatypesJSON(TypedDict): 340 """ 341 Endpoint '/datatypes' 342 Represents the JSON response structure for the '/datatypes' endpoint. 343 """ # noqa: E501 344 345 metadata: MetadataJSON 346 """ 347 Metadata information about the response. 348 """ 349 350 results: list[DatatypeJSON] 351 """ 352 A list of data types returned in the response. 353 """
Endpoint '/datatypes' Represents the JSON response structure for the '/datatypes' endpoint.
359class LocationcategoryIDJSON(TypedDict): 360 """ 361 Endpoint '/locationcategories/{id}' 362 Represents the JSON response structure for a specific location category identified by its ID. 363 """ # noqa: E501 364 365 name: str 366 """ 367 The name of the location category. 368 """ 369 370 id: str 371 """ 372 The unique identifier for the location category. 373 """
Endpoint '/locationcategories/{id}' Represents the JSON response structure for a specific location category identified by its ID.
379class LocationcategoriesJSON(TypedDict): 380 """ 381 Endpoint '/locationcategories' 382 Represents the JSON response structure for the '/locationcategories' endpoint. 383 """ # noqa: E501 384 385 metadata: MetadataJSON 386 """ 387 Metadata information about the response. 388 """ 389 390 results: list[LocationcategoryIDJSON] 391 """ 392 A list of location categories returned in the response. 393 """
Endpoint '/locationcategories' Represents the JSON response structure for the '/locationcategories' endpoint.
399class LocationIDJSON(TypedDict): 400 """ 401 Endpoint '/locations/{id}' 402 Represents the JSON response structure for a specific location identified by its ID. 403 """ # noqa: E501 404 405 mindate: str # Date as "YYYY-MM-DD" 406 """ 407 The earliest date for which data is available for the location, formatted as 'YYYY-MM-DD'. 408 """ # noqa: E501 409 410 maxdate: str # Date as "YYYY-MM-DD" 411 """ 412 The latest date for which data is available for the location, formatted as 'YYYY-MM-DD'. 413 """ # noqa: E501 414 415 name: str 416 """ 417 The name of the location. 418 """ 419 420 datacoverage: float | int 421 """ 422 The proportion of data coverage for the location. 423 """ 424 425 id: str 426 """ 427 The unique identifier for the location. 428 """
Endpoint '/locations/{id}' Represents the JSON response structure for a specific location identified by its ID.
The earliest date for which data is available for the location, formatted as 'YYYY-MM-DD'.
434class LocationsJSON(TypedDict): 435 """ 436 Endpoint '/locations' 437 Represents the JSON response structure for the '/locations' endpoint. 438 """ # noqa: E501 439 440 metadata: MetadataJSON 441 """ 442 Metadata information about the response, including pagination details. 443 """ 444 445 results: list[LocationIDJSON] 446 """ 447 A list of location records returned by the query. 448 """
Endpoint '/locations' Represents the JSON response structure for the '/locations' endpoint.
454class StationIDJSON(TypedDict): 455 """ 456 Endpoint '/stations/{id}' 457 Represents the JSON response structure for a specific station identified by its ID from the '/stations/{id}' endpoint. 458 """ # noqa: E501 459 460 elevation: int | float 461 """ 462 The elevation of the station in meters. 463 """ 464 465 mindate: str # Date as "YYYY-MM-DD" 466 """ 467 The earliest date for which data is available, formatted as 'YYYY-MM-DD'. 468 """ 469 470 maxdate: str # Date as "YYYY-MM-DD" 471 """ 472 The latest date for which data is available, formatted as 'YYYY-MM-DD'. 473 """ 474 475 latitude: float | int 476 """ 477 The latitude coordinate of the station. 478 """ 479 480 name: str 481 """ 482 The name of the station. 483 """ 484 485 datacoverage: float | int 486 """ 487 The proportion of data coverage, ranging from 0 to 1. 488 """ 489 490 id: str 491 """ 492 The unique identifier for the station. 493 """ 494 495 elevationUnit: str 496 """ 497 The unit of measurement for elevation (e.g., 'METERS'). 498 """ 499 500 longitude: float | int 501 """ 502 The longitude coordinate of the station. 503 """
Endpoint '/stations/{id}' Represents the JSON response structure for a specific station identified by its ID from the '/stations/{id}' endpoint.
509class StationsJSON(TypedDict): 510 """ 511 Endpoint '/stations' 512 Represents the JSON response structure for the '/stations' endpoint. 513 """ # noqa: E501 514 515 metadata: MetadataJSON 516 """ 517 Metadata information about the response, including pagination details. 518 """ 519 520 results: list[StationIDJSON] 521 """ 522 A list of station records returned by the query. 523 """
Endpoint '/stations' Represents the JSON response structure for the '/stations' endpoint.
529class DatapointJSON(TypedDict): 530 """ 531 Endpoint '/data?datasetid=YOUR_DATASETID' (subcomponent) 532 Represents a single data point in the response from the 'data?datasetid=YOUR_DATASETID' endpoint. (subcomponent) 533 """ # noqa: E501 534 535 date: str # Date as "YYYY-MM-DDTHH:MM:SS" 536 """ 537 The date and time of the observation, formatted as 'YYYY-MM-DDTHH:MM:SS'. 538 """ 539 540 datatype: str 541 """ 542 The type of data recorded (e.g., temperature, precipitation). 543 """ 544 545 station: str 546 """ 547 The identifier of the station where the data was recorded. 548 """ 549 550 attributes: NotRequired[str] 551 """ 552 Additional attributes or flags associated with the data point. 553 """ 554 555 value: float | int 556 """ 557 The recorded value of the data point. 558 """
Endpoint '/data?datasetid=YOUR_DATASETID' (subcomponent) Represents a single data point in the response from the 'data?datasetid=YOUR_DATASETID' endpoint. (subcomponent)
561class DataJSON(TypedDict): 562 """ 563 Endpoint '/data?datasetid=YOUR_DATASETID' 564 Represents the full JSON response structure for the '/data?datasetid=YOUR_DATASETID' endpoint. 565 """ # noqa: E501 566 567 metadata: MetadataJSON 568 """ 569 Metadata information about the response, including pagination details. 570 """ 571 572 results: list[DatapointJSON] 573 """ 574 A list of data points returned by the query. 575 """
Endpoint '/data?datasetid=YOUR_DATASETID' Represents the full JSON response structure for the '/data?datasetid=YOUR_DATASETID' endpoint.