noaa_api.parameter_schemas

NOAA API Query Parameter Schemas

This module defines TypedDict structures representing valid query parameters for various NOAA NCEI API v2 endpoints. These schemas provide type safety and enforce expected query structures.

Each class corresponds to a specific API endpoint, detailing the expected parameters and their types.

Integration with aiohttp:

These parameter schemas are specifically designed to be used with aiohttp's ClientSession.get method's params keyword argument. For example:

async with aiohttp.ClientSession() as session:
    params: parameter_schemas.DatasetsParameters = {
        "datatypeid": "TMAX",
        "startdate": "2020-01-01",
        "limit": 100
    }
    async with session.get("https://api.example.com/datasets", params=params) as response:
        data = await response.json()

The schemas ensure that the parameters match aiohttp's expectations for query string generation (see: https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession.get). Key features:

  • Type safety for parameter values
  • Automatic conversion of parameters to proper URL encoding
  • Support for multi-value parameters using & separation
  • Validation of enum values (e.g., sortorder, units)

Schemas:

Notes:

  • Many parameters support filtering via singular values or chains separated by & (e.g., "GHCND:USW00094728&GHCND:USC00042319").
  • Dates must be formatted as "YYYY-MM-DD" or "YYYY-MM-DDThh:mm:ss".
  • sortfield and sortorder control result sorting.
  • limit and offset allow pagination (default limit=25, max limit=1000).
  • units determines unit conversion ("standard" or "metric").
  • includemetadata is a boolean flag to include or exclude metadata from responses.
  • extent (in StationsParameters) defines a bounding box for geographic filtering.

Advanced Usage:

  1. Multi-value Parameters:

    params: parameter_schemas.StationsParameters = {
        "stationid": "GHCND:USW00094728&GHCND:USC00042319",
        # OR as a joined list
        "stationid": "&".join(["GHCND:USW00094728", "GHCND:USC00042319"])
    }
    
  2. Geographic Filtering:

    params: parameter_schemas.StationsParameters = {
        "extent": "42.0,-90.0,40.0,-88.0",  # north,west,south,east
        "datasetid": "GHCND"
    }
    
  3. Required Parameters:

    params: parameter_schemas.DataParameters = {
        "datasetid": "GHCND",  # Required
        "startdate": "2020-01-01",  # Required
        "enddate": "2020-12-31",  # Required
        "units": "metric"  # Optional
    }
    

These schemas facilitate type checking and autocompletion in IDEs while working with the NOAA API.

  1"""
  2NOAA API Query Parameter Schemas
  3================================
  4
  5This module defines `TypedDict` structures representing valid query parameters for various NOAA NCEI API v2 endpoints. These schemas provide type safety and enforce expected query structures.
  6
  7Each class corresponds to a specific API endpoint, detailing the expected parameters and their types.
  8
  9Integration with aiohttp:
 10----------------------
 11These parameter schemas are specifically designed to be used with aiohttp's ClientSession.get method's
 12`params` keyword argument. For example:
 13
 14```python
 15async with aiohttp.ClientSession() as session:
 16    params: parameter_schemas.DatasetsParameters = {
 17        "datatypeid": "TMAX",
 18        "startdate": "2020-01-01",
 19        "limit": 100
 20    }
 21    async with session.get("https://api.example.com/datasets", params=params) as response:
 22        data = await response.json()
 23```
 24
 25The schemas ensure that the parameters match aiohttp's expectations for query string generation
 26(see: https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession.get).
 27Key features:
 28- Type safety for parameter values
 29- Automatic conversion of parameters to proper URL encoding
 30- Support for multi-value parameters using & separation
 31- Validation of enum values (e.g., sortorder, units)
 32
 33Schemas:
 34--------
 35 - `DatasetsParameters`: Parameters for querying `/datasets`.
 36 - `DatacategoriesParameters`: Parameters for querying `/datacategories`.
 37 - `DatatypesParameters`: Parameters for querying `/datatypes`.
 38 - `LocationcategoriesParameters`: Parameters for querying `/locationcategories`.
 39 - `LocationsParameters`: Parameters for querying `/locations`.
 40 - `StationsParameters`: Parameters for querying `/stations`.
 41 - `DataParameters`: Parameters for querying `/data`.
 42
 43Notes:
 44------
 45 - Many parameters support filtering via singular values or chains separated by `&` (e.g., `"GHCND:USW00094728&GHCND:USC00042319"`).
 46 - Dates must be formatted as `"YYYY-MM-DD"` or `"YYYY-MM-DDThh:mm:ss"`.
 47 - `sortfield` and `sortorder` control result sorting.
 48 - `limit` and `offset` allow pagination (default `limit=25`, max `limit=1000`).
 49 - `units` determines unit conversion (`"standard"` or `"metric"`).
 50 - `includemetadata` is a boolean flag to include or exclude metadata from responses.
 51 - `extent` (in `StationsParameters`) defines a bounding box for geographic filtering.
 52
 53Advanced Usage:
 54-------------
 551. Multi-value Parameters:
 56   ```python
 57   params: parameter_schemas.StationsParameters = {
 58       "stationid": "GHCND:USW00094728&GHCND:USC00042319",
 59       # OR as a joined list
 60       "stationid": "&".join(["GHCND:USW00094728", "GHCND:USC00042319"])
 61   }
 62   ```
 63
 642. Geographic Filtering:
 65   ```python
 66   params: parameter_schemas.StationsParameters = {
 67       "extent": "42.0,-90.0,40.0,-88.0",  # north,west,south,east
 68       "datasetid": "GHCND"
 69   }
 70   ```
 71
 723. Required Parameters:
 73   ```python
 74   params: parameter_schemas.DataParameters = {
 75       "datasetid": "GHCND",  # Required
 76       "startdate": "2020-01-01",  # Required
 77       "enddate": "2020-12-31",  # Required
 78       "units": "metric"  # Optional
 79   }
 80   ```
 81
 82These schemas facilitate type checking and autocompletion in IDEs while working with the NOAA API.
 83"""  # noqa: E501
 84
 85from typing import Literal, Required, TypedDict
 86
 87Sortfield = Literal["id", "name", "mindate", "maxdate", "datacoverage", ""]
 88"""
 89Literal set of values for the api 'sortfield'. Only for DatasetsParameters, DatacategoriesParameters, DatatypesParameters, LocationcategoriesParameters, LocationsParameters, StationsParameters. **NOT for DataParameters**
 90"""  # noqa: E501
 91DataSortField = Literal["datatype", "date", "station"]
 92
 93Sortorder = Literal["asc", "desc"]
 94"""
 95Literal set of values for the api 'sortorder' (ascend or descend)
 96"""
 97
 98Units = Literal["standard", "metric", ""]
 99"""
100Literal set of values for 'units' parameter in DataParameters. Default value yields no conversion.
101"""  # noqa: E501
102
103
104class DatasetsParameters(TypedDict, total=False):
105    """
106    Parameters for querying the `/datasets` endpoint of the NOAA NCEI API v2.
107    """  # noqa: E501
108
109    datatypeid: str  # Singular or chain seperated by &
110    """
111    Filter by data type ID(s). Can be a single value or multiple values separated by '&'.
112    """  # noqa: E501
113
114    locationid: str  # Singular or chain seperated by &
115    """
116    Filter by location ID(s). Can be a single value or multiple values separated by '&'.
117    """  # noqa: E501
118
119    stationid: str  # Singular or chain seperated by &
120    """
121    Filter by station ID(s). Can be a single value or multiple values separated by '&'.
122    """
123
124    startdate: str  # YYYY-MM-DD
125    """
126    Beginning of date range in 'YYYY-MM-DD' format.
127    """
128
129    enddate: str  # YYYY-MM-DD
130    """
131    End of date range in 'YYYY-MM-DD' format.
132    """
133
134    sortfield: Sortfield  # Default is "id"
135    """
136    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
137    """  # noqa: E501
138
139    sortorder: Sortorder  # Default is "asc"
140    """
141    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
142    """
143
144    limit: int  # Default is 25. Maximum is 1000
145    """
146    Maximum number of results to return. Default is 25, maximum is 1000.
147    """
148
149    offset: int  # Default is 0
150    """
151    Number of results to skip for pagination. Default is 0.
152    """
153
154
155class DatacategoriesParameters(TypedDict, total=False):
156    """
157    Parameters for querying the `/datacategories` endpoint of the NOAA NCEI API v2.
158    """  # noqa: E501
159
160    datasetid: str  # Singular or chain seperated by &
161    """
162    Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.
163    """
164
165    locationid: str  # Singular or chain seperated by &
166    """
167    Filter by location ID(s). Can be a single value or multiple values separated by '&'.
168    """
169
170    stationid: str  # Singular or chain seperated by &
171    """
172    Filter by station ID(s). Can be a single value or multiple values separated by '&'.
173    """
174
175    startdate: str  # YYYY-MM-DD
176    """
177    Beginning of date range in 'YYYY-MM-DD' format.
178    """
179
180    enddate: str  # YYYY-MM-DD
181    """
182    End of date range in 'YYYY-MM-DD' format.
183    """
184
185    sortfield: Sortfield  # Default is "id"
186    """
187    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
188    """  # noqa: E501
189
190    sortorder: Sortorder  # Default is "asc"
191    """
192    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
193    """
194
195    limit: int  # Default is 25. Maximum is 1000
196    """
197    Maximum number of results to return. Default is 25, maximum is 1000.
198    """
199
200    offset: int  # Default is 0
201    """
202    Number of results to skip for pagination. Default is 0.
203    """
204
205
206class DatatypesParameters(TypedDict, total=False):
207    """
208    Parameters for querying the `/datatypes` endpoint of the NOAA NCEI API v2.
209    """  # noqa: E501
210
211    datasetid: str  # Singular or chain separated by &
212    """
213    Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.
214    """
215
216    locationid: str  # Singular or chain separated by &
217    """
218    Filter by location ID(s). Can be a single value or multiple values separated by '&'.
219    """
220
221    stationid: str  # Singular or chain separated by &
222    """
223    Filter by station ID(s). Can be a single value or multiple values separated by '&'.
224    """
225
226    datacategoryid: str  # Singular or chain separated by &
227    """
228    Filter by data category ID(s). Can be a single value or multiple values separated by '&'.
229    """  # noqa: E501
230
231    startdate: str  # YYYY-MM-DD
232    """
233    Beginning of date range in 'YYYY-MM-DD' format.
234    """
235
236    enddate: str  # YYYY-MM-DD
237    """
238    End of date range in 'YYYY-MM-DD' format.
239    """
240
241    sortfield: Sortfield  # Default is "id"
242    """
243    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
244    """  # noqa: E501
245
246    sortorder: Sortorder  # Default is "asc"
247    """
248    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
249    """
250
251    limit: int  # Default is 25. Maximum is 1000
252    """
253    Maximum number of results to return. Default is 25, maximum is 1000.
254    """
255
256    offset: int  # Default is 0
257    """
258    Number of results to skip for pagination. Default is 0.
259    """
260
261
262class LocationcategoriesParameters(TypedDict, total=False):
263    """
264    Parameters for querying the `/locationcategories` endpoint of the NOAA NCEI API v2.
265    """  # noqa: E501
266
267    datasetid: str  # Singular or chain separated by &
268    """
269    Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.
270    """
271
272    startdate: str  # YYYY-MM-DD
273    """
274    Beginning of date range in 'YYYY-MM-DD' format.
275    """
276
277    enddate: str  # YYYY-MM-DD
278    """
279    End of date range in 'YYYY-MM-DD' format.
280    """
281
282    sortfield: Sortfield  # Default is "id"
283    """
284    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
285    """  # noqa: E501
286
287    sortorder: Sortorder  # Default is "asc"
288    """
289    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
290    """
291
292    limit: int  # Default is 25. Maximum is 1000
293    """
294    Maximum number of results to return. Default is 25, maximum is 1000.
295    """
296
297    offset: int  # Default is 0
298    """
299    Number of results to skip for pagination. Default is 0.
300    """
301
302
303class LocationsParameters(TypedDict, total=False):
304    """
305    Parameters for querying the `/locations` endpoint of the NOAA NCEI API v2.
306    """  # noqa: E501
307
308    datasetid: str  # Singular or chain separated by &
309    """
310    Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.
311    """
312
313    locationcategoryid: str  # Singular or chain separated by &
314    """
315    Filter by location category ID(s). Can be a single value or multiple values separated by '&'.
316    """  # noqa: E501
317
318    datacategoryid: str  # Singular or array of data category IDs
319    """
320    Filter by data category ID(s). Can be a single value or an array of data category IDs.
321    """  # noqa: E501
322
323    startdate: str  # YYYY-MM-DD
324    """
325    Beginning of date range in 'YYYY-MM-DD' format.
326    """
327
328    enddate: str  # YYYY-MM-DD
329    """
330    End of date range in 'YYYY-MM-DD' format.
331    """
332
333    sortfield: Sortfield  # Default is "id"
334    """
335    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
336    """  # noqa: E501
337
338    sortorder: Sortorder  # Default is "asc"
339    """
340    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
341    """
342
343    limit: int  # Default is 25. Maximum is 1000
344    """
345    Maximum number of results to return. Default is 25, maximum is 1000.
346    """
347
348    offset: int  # Default is 0
349    """
350    Number of results to skip for pagination. Default is 0.
351    """
352
353
354class StationsParameters(TypedDict, total=False):
355    """
356    Parameters for querying the `/stations` endpoint of the NOAA NCEI API v2.
357    """  # noqa: E501
358
359    datasetid: str  # Singular or chain separated by &
360    """
361    Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.
362    """
363
364    locationid: str  # Singular or chain separated by &
365    """
366    Filter by location ID(s). Can be a single value or multiple values separated by '&'.
367    """
368
369    datacategoryid: str  # Singular or array of data category IDs
370    """
371    Filter by data category ID(s). Can be a single value or an array of data category IDs.
372    """  # noqa: E501
373
374    datatypeid: str  # Singular or chain separated by &
375    """
376    Filter by data type ID(s). Can be a single value or multiple values separated by '&'.
377    """  # noqa: E501
378
379    extent: str  # Geographical extent (latitude_min,longitude_min,latitude_max,longitude_max)  # noqa: E501
380    """
381    Geographical bounding box in format "latitude_min,longitude_min,latitude_max,longitude_max". (LatLngBounds.toUrlValue format)
382    """  # noqa: E501
383
384    startdate: str  # YYYY-MM-DD
385    """
386    Beginning of date range in 'YYYY-MM-DD' format.
387    """
388
389    enddate: str  # YYYY-MM-DD
390    """
391    End of date range in 'YYYY-MM-DD' format.
392    """
393
394    sortfield: Sortfield  # Default is "id"
395    """
396    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
397    """  # noqa: E501
398
399    sortorder: Sortorder  # Default is "asc"
400    """
401    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
402    """
403
404    limit: int  # Default is 25. Maximum is 1000
405    """
406    Maximum number of results to return. Default is 25, maximum is 1000.
407    """
408
409    offset: int  # Default is 0
410    """
411    Number of results to skip for pagination. Default is 0.
412    """
413
414
415class DataParameters(TypedDict, total=False):
416    """
417    Parameters for querying the `/data` endpoint of the NOAA NCEI API v2.
418    """  # noqa: E501
419
420    datasetid: Required[str]  # Required. A valid dataset id
421    """
422    Required. A valid dataset ID.
423    """
424
425    datatypeid: str  # Singular or chain separated by &
426    """
427    Filter by data type ID(s). Can be a single value or multiple values separated by '&'.
428    """  # noqa: E501
429
430    locationid: str  # Singular or chain separated by &
431    """
432    Filter by location ID(s). Can be a single value or multiple values separated by '&'.
433    """
434
435    stationid: str  # Singular or chain separated by &
436    """
437    Filter by station ID(s). Can be a single value or multiple values separated by '&'.
438    """
439
440    startdate: Required[
441        str
442    ]  # Required. Valid ISO formatted date (YYYY-MM-DD) or datetime (YYYY-MM-DDThh:mm:ss)  # noqa: E501
443    """
444    Required. Beginning of date range in 'YYYY-MM-DD' format or 'YYYY-MM-DDThh:mm:ss' datetime format.
445    """  # noqa: E501
446
447    enddate: Required[
448        str
449    ]  # Required. Valid ISO formatted date (YYYY-MM-DD) or datetime (YYYY-MM-DDThh:mm:ss)  # noqa: E501
450    # Note: Annual and Monthly data will be limited to a 10 year range while other data will be limited to a 1 year range  # noqa: E501
451    """
452    Required. End of date range in 'YYYY-MM-DD' format or 'YYYY-MM-DDThh:mm:ss' datetime format.
453    Note: Annual and monthly data will be limited to a 10-year range while other data will be limited to a 1-year range.
454    """  # noqa: E501
455
456    units: Units  # Default is no conversion
457    """
458    Unit conversion, either "standard" or "metric". Default is no conversion.
459    """
460
461    sortfield: DataSortField
462    """
463    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage".
464    """  # noqa: E501
465
466    sortorder: Sortorder  # Default is "asc"
467    """
468    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
469    """
470
471    limit: int  # Default is 25. Maximum is 1000
472    """
473    Maximum number of results to return. Default is 25, maximum is 1000.
474    """
475
476    offset: int  # Default is 0
477    """
478    Number of results to skip for pagination. Default is 0.
479    """
480
481    includemetadata: (
482        str  # Default is True, set to False to exclude metadata calculation
483    )
484    """
485    Whether to include metadata in the response. Default is True.
486    """
487
488
489AnyParameter = (
490    DatasetsParameters
491    | DatacategoriesParameters
492    | DatatypesParameters
493    | LocationcategoriesParameters
494    | LocationsParameters
495    | StationsParameters
496    | DataParameters
497)
498"""
499Union type representing any valid NOAA API parameter dictionary.
500Can be one of:
501- DatasetsParameters
502- DatacategoriesParameters
503- DatatypesParameters
504- LocationcategoriesParameters
505- LocationsParameters
506- StationsParameters
507- DataParameters
508"""
Sortfield = typing.Literal['id', 'name', 'mindate', 'maxdate', 'datacoverage', '']

Literal set of values for the api 'sortfield'. Only for DatasetsParameters, DatacategoriesParameters, DatatypesParameters, LocationcategoriesParameters, LocationsParameters, StationsParameters. NOT for DataParameters

DataSortField = typing.Literal['datatype', 'date', 'station']
Sortorder = typing.Literal['asc', 'desc']

Literal set of values for the api 'sortorder' (ascend or descend)

Units = typing.Literal['standard', 'metric', '']

Literal set of values for 'units' parameter in DataParameters. Default value yields no conversion.

class DatasetsParameters(typing.TypedDict):
105class DatasetsParameters(TypedDict, total=False):
106    """
107    Parameters for querying the `/datasets` endpoint of the NOAA NCEI API v2.
108    """  # noqa: E501
109
110    datatypeid: str  # Singular or chain seperated by &
111    """
112    Filter by data type ID(s). Can be a single value or multiple values separated by '&'.
113    """  # noqa: E501
114
115    locationid: str  # Singular or chain seperated by &
116    """
117    Filter by location ID(s). Can be a single value or multiple values separated by '&'.
118    """  # noqa: E501
119
120    stationid: str  # Singular or chain seperated by &
121    """
122    Filter by station ID(s). Can be a single value or multiple values separated by '&'.
123    """
124
125    startdate: str  # YYYY-MM-DD
126    """
127    Beginning of date range in 'YYYY-MM-DD' format.
128    """
129
130    enddate: str  # YYYY-MM-DD
131    """
132    End of date range in 'YYYY-MM-DD' format.
133    """
134
135    sortfield: Sortfield  # Default is "id"
136    """
137    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
138    """  # noqa: E501
139
140    sortorder: Sortorder  # Default is "asc"
141    """
142    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
143    """
144
145    limit: int  # Default is 25. Maximum is 1000
146    """
147    Maximum number of results to return. Default is 25, maximum is 1000.
148    """
149
150    offset: int  # Default is 0
151    """
152    Number of results to skip for pagination. Default is 0.
153    """

Parameters for querying the /datasets endpoint of the NOAA NCEI API v2.

datatypeid: str

Filter by data type ID(s). Can be a single value or multiple values separated by '&'.

locationid: str

Filter by location ID(s). Can be a single value or multiple values separated by '&'.

stationid: str

Filter by station ID(s). Can be a single value or multiple values separated by '&'.

startdate: str

Beginning of date range in 'YYYY-MM-DD' format.

enddate: str

End of date range in 'YYYY-MM-DD' format.

sortfield: Literal['id', 'name', 'mindate', 'maxdate', 'datacoverage', '']

Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".

sortorder: Literal['asc', 'desc']

Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".

limit: int

Maximum number of results to return. Default is 25, maximum is 1000.

offset: int

Number of results to skip for pagination. Default is 0.

class DatacategoriesParameters(typing.TypedDict):
156class DatacategoriesParameters(TypedDict, total=False):
157    """
158    Parameters for querying the `/datacategories` endpoint of the NOAA NCEI API v2.
159    """  # noqa: E501
160
161    datasetid: str  # Singular or chain seperated by &
162    """
163    Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.
164    """
165
166    locationid: str  # Singular or chain seperated by &
167    """
168    Filter by location ID(s). Can be a single value or multiple values separated by '&'.
169    """
170
171    stationid: str  # Singular or chain seperated by &
172    """
173    Filter by station ID(s). Can be a single value or multiple values separated by '&'.
174    """
175
176    startdate: str  # YYYY-MM-DD
177    """
178    Beginning of date range in 'YYYY-MM-DD' format.
179    """
180
181    enddate: str  # YYYY-MM-DD
182    """
183    End of date range in 'YYYY-MM-DD' format.
184    """
185
186    sortfield: Sortfield  # Default is "id"
187    """
188    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
189    """  # noqa: E501
190
191    sortorder: Sortorder  # Default is "asc"
192    """
193    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
194    """
195
196    limit: int  # Default is 25. Maximum is 1000
197    """
198    Maximum number of results to return. Default is 25, maximum is 1000.
199    """
200
201    offset: int  # Default is 0
202    """
203    Number of results to skip for pagination. Default is 0.
204    """

Parameters for querying the /datacategories endpoint of the NOAA NCEI API v2.

datasetid: str

Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.

locationid: str

Filter by location ID(s). Can be a single value or multiple values separated by '&'.

stationid: str

Filter by station ID(s). Can be a single value or multiple values separated by '&'.

startdate: str

Beginning of date range in 'YYYY-MM-DD' format.

enddate: str

End of date range in 'YYYY-MM-DD' format.

sortfield: Literal['id', 'name', 'mindate', 'maxdate', 'datacoverage', '']

Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".

sortorder: Literal['asc', 'desc']

Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".

limit: int

Maximum number of results to return. Default is 25, maximum is 1000.

offset: int

Number of results to skip for pagination. Default is 0.

class DatatypesParameters(typing.TypedDict):
207class DatatypesParameters(TypedDict, total=False):
208    """
209    Parameters for querying the `/datatypes` endpoint of the NOAA NCEI API v2.
210    """  # noqa: E501
211
212    datasetid: str  # Singular or chain separated by &
213    """
214    Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.
215    """
216
217    locationid: str  # Singular or chain separated by &
218    """
219    Filter by location ID(s). Can be a single value or multiple values separated by '&'.
220    """
221
222    stationid: str  # Singular or chain separated by &
223    """
224    Filter by station ID(s). Can be a single value or multiple values separated by '&'.
225    """
226
227    datacategoryid: str  # Singular or chain separated by &
228    """
229    Filter by data category ID(s). Can be a single value or multiple values separated by '&'.
230    """  # noqa: E501
231
232    startdate: str  # YYYY-MM-DD
233    """
234    Beginning of date range in 'YYYY-MM-DD' format.
235    """
236
237    enddate: str  # YYYY-MM-DD
238    """
239    End of date range in 'YYYY-MM-DD' format.
240    """
241
242    sortfield: Sortfield  # Default is "id"
243    """
244    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
245    """  # noqa: E501
246
247    sortorder: Sortorder  # Default is "asc"
248    """
249    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
250    """
251
252    limit: int  # Default is 25. Maximum is 1000
253    """
254    Maximum number of results to return. Default is 25, maximum is 1000.
255    """
256
257    offset: int  # Default is 0
258    """
259    Number of results to skip for pagination. Default is 0.
260    """

Parameters for querying the /datatypes endpoint of the NOAA NCEI API v2.

datasetid: str

Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.

locationid: str

Filter by location ID(s). Can be a single value or multiple values separated by '&'.

stationid: str

Filter by station ID(s). Can be a single value or multiple values separated by '&'.

datacategoryid: str

Filter by data category ID(s). Can be a single value or multiple values separated by '&'.

startdate: str

Beginning of date range in 'YYYY-MM-DD' format.

enddate: str

End of date range in 'YYYY-MM-DD' format.

sortfield: Literal['id', 'name', 'mindate', 'maxdate', 'datacoverage', '']

Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".

sortorder: Literal['asc', 'desc']

Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".

limit: int

Maximum number of results to return. Default is 25, maximum is 1000.

offset: int

Number of results to skip for pagination. Default is 0.

class LocationcategoriesParameters(typing.TypedDict):
263class LocationcategoriesParameters(TypedDict, total=False):
264    """
265    Parameters for querying the `/locationcategories` endpoint of the NOAA NCEI API v2.
266    """  # noqa: E501
267
268    datasetid: str  # Singular or chain separated by &
269    """
270    Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.
271    """
272
273    startdate: str  # YYYY-MM-DD
274    """
275    Beginning of date range in 'YYYY-MM-DD' format.
276    """
277
278    enddate: str  # YYYY-MM-DD
279    """
280    End of date range in 'YYYY-MM-DD' format.
281    """
282
283    sortfield: Sortfield  # Default is "id"
284    """
285    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
286    """  # noqa: E501
287
288    sortorder: Sortorder  # Default is "asc"
289    """
290    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
291    """
292
293    limit: int  # Default is 25. Maximum is 1000
294    """
295    Maximum number of results to return. Default is 25, maximum is 1000.
296    """
297
298    offset: int  # Default is 0
299    """
300    Number of results to skip for pagination. Default is 0.
301    """

Parameters for querying the /locationcategories endpoint of the NOAA NCEI API v2.

datasetid: str

Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.

startdate: str

Beginning of date range in 'YYYY-MM-DD' format.

enddate: str

End of date range in 'YYYY-MM-DD' format.

sortfield: Literal['id', 'name', 'mindate', 'maxdate', 'datacoverage', '']

Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".

sortorder: Literal['asc', 'desc']

Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".

limit: int

Maximum number of results to return. Default is 25, maximum is 1000.

offset: int

Number of results to skip for pagination. Default is 0.

class LocationsParameters(typing.TypedDict):
304class LocationsParameters(TypedDict, total=False):
305    """
306    Parameters for querying the `/locations` endpoint of the NOAA NCEI API v2.
307    """  # noqa: E501
308
309    datasetid: str  # Singular or chain separated by &
310    """
311    Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.
312    """
313
314    locationcategoryid: str  # Singular or chain separated by &
315    """
316    Filter by location category ID(s). Can be a single value or multiple values separated by '&'.
317    """  # noqa: E501
318
319    datacategoryid: str  # Singular or array of data category IDs
320    """
321    Filter by data category ID(s). Can be a single value or an array of data category IDs.
322    """  # noqa: E501
323
324    startdate: str  # YYYY-MM-DD
325    """
326    Beginning of date range in 'YYYY-MM-DD' format.
327    """
328
329    enddate: str  # YYYY-MM-DD
330    """
331    End of date range in 'YYYY-MM-DD' format.
332    """
333
334    sortfield: Sortfield  # Default is "id"
335    """
336    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
337    """  # noqa: E501
338
339    sortorder: Sortorder  # Default is "asc"
340    """
341    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
342    """
343
344    limit: int  # Default is 25. Maximum is 1000
345    """
346    Maximum number of results to return. Default is 25, maximum is 1000.
347    """
348
349    offset: int  # Default is 0
350    """
351    Number of results to skip for pagination. Default is 0.
352    """

Parameters for querying the /locations endpoint of the NOAA NCEI API v2.

datasetid: str

Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.

locationcategoryid: str

Filter by location category ID(s). Can be a single value or multiple values separated by '&'.

datacategoryid: str

Filter by data category ID(s). Can be a single value or an array of data category IDs.

startdate: str

Beginning of date range in 'YYYY-MM-DD' format.

enddate: str

End of date range in 'YYYY-MM-DD' format.

sortfield: Literal['id', 'name', 'mindate', 'maxdate', 'datacoverage', '']

Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".

sortorder: Literal['asc', 'desc']

Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".

limit: int

Maximum number of results to return. Default is 25, maximum is 1000.

offset: int

Number of results to skip for pagination. Default is 0.

class StationsParameters(typing.TypedDict):
355class StationsParameters(TypedDict, total=False):
356    """
357    Parameters for querying the `/stations` endpoint of the NOAA NCEI API v2.
358    """  # noqa: E501
359
360    datasetid: str  # Singular or chain separated by &
361    """
362    Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.
363    """
364
365    locationid: str  # Singular or chain separated by &
366    """
367    Filter by location ID(s). Can be a single value or multiple values separated by '&'.
368    """
369
370    datacategoryid: str  # Singular or array of data category IDs
371    """
372    Filter by data category ID(s). Can be a single value or an array of data category IDs.
373    """  # noqa: E501
374
375    datatypeid: str  # Singular or chain separated by &
376    """
377    Filter by data type ID(s). Can be a single value or multiple values separated by '&'.
378    """  # noqa: E501
379
380    extent: str  # Geographical extent (latitude_min,longitude_min,latitude_max,longitude_max)  # noqa: E501
381    """
382    Geographical bounding box in format "latitude_min,longitude_min,latitude_max,longitude_max". (LatLngBounds.toUrlValue format)
383    """  # noqa: E501
384
385    startdate: str  # YYYY-MM-DD
386    """
387    Beginning of date range in 'YYYY-MM-DD' format.
388    """
389
390    enddate: str  # YYYY-MM-DD
391    """
392    End of date range in 'YYYY-MM-DD' format.
393    """
394
395    sortfield: Sortfield  # Default is "id"
396    """
397    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".
398    """  # noqa: E501
399
400    sortorder: Sortorder  # Default is "asc"
401    """
402    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
403    """
404
405    limit: int  # Default is 25. Maximum is 1000
406    """
407    Maximum number of results to return. Default is 25, maximum is 1000.
408    """
409
410    offset: int  # Default is 0
411    """
412    Number of results to skip for pagination. Default is 0.
413    """

Parameters for querying the /stations endpoint of the NOAA NCEI API v2.

datasetid: str

Filter by dataset ID(s). Can be a single value or multiple values separated by '&'.

locationid: str

Filter by location ID(s). Can be a single value or multiple values separated by '&'.

datacategoryid: str

Filter by data category ID(s). Can be a single value or an array of data category IDs.

datatypeid: str

Filter by data type ID(s). Can be a single value or multiple values separated by '&'.

extent: str

Geographical bounding box in format "latitude_min,longitude_min,latitude_max,longitude_max". (LatLngBounds.toUrlValue format)

startdate: str

Beginning of date range in 'YYYY-MM-DD' format.

enddate: str

End of date range in 'YYYY-MM-DD' format.

sortfield: Literal['id', 'name', 'mindate', 'maxdate', 'datacoverage', '']

Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage". Default is "id".

sortorder: Literal['asc', 'desc']

Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".

limit: int

Maximum number of results to return. Default is 25, maximum is 1000.

offset: int

Number of results to skip for pagination. Default is 0.

class DataParameters(typing.TypedDict):
416class DataParameters(TypedDict, total=False):
417    """
418    Parameters for querying the `/data` endpoint of the NOAA NCEI API v2.
419    """  # noqa: E501
420
421    datasetid: Required[str]  # Required. A valid dataset id
422    """
423    Required. A valid dataset ID.
424    """
425
426    datatypeid: str  # Singular or chain separated by &
427    """
428    Filter by data type ID(s). Can be a single value or multiple values separated by '&'.
429    """  # noqa: E501
430
431    locationid: str  # Singular or chain separated by &
432    """
433    Filter by location ID(s). Can be a single value or multiple values separated by '&'.
434    """
435
436    stationid: str  # Singular or chain separated by &
437    """
438    Filter by station ID(s). Can be a single value or multiple values separated by '&'.
439    """
440
441    startdate: Required[
442        str
443    ]  # Required. Valid ISO formatted date (YYYY-MM-DD) or datetime (YYYY-MM-DDThh:mm:ss)  # noqa: E501
444    """
445    Required. Beginning of date range in 'YYYY-MM-DD' format or 'YYYY-MM-DDThh:mm:ss' datetime format.
446    """  # noqa: E501
447
448    enddate: Required[
449        str
450    ]  # Required. Valid ISO formatted date (YYYY-MM-DD) or datetime (YYYY-MM-DDThh:mm:ss)  # noqa: E501
451    # Note: Annual and Monthly data will be limited to a 10 year range while other data will be limited to a 1 year range  # noqa: E501
452    """
453    Required. End of date range in 'YYYY-MM-DD' format or 'YYYY-MM-DDThh:mm:ss' datetime format.
454    Note: Annual and monthly data will be limited to a 10-year range while other data will be limited to a 1-year range.
455    """  # noqa: E501
456
457    units: Units  # Default is no conversion
458    """
459    Unit conversion, either "standard" or "metric". Default is no conversion.
460    """
461
462    sortfield: DataSortField
463    """
464    Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage".
465    """  # noqa: E501
466
467    sortorder: Sortorder  # Default is "asc"
468    """
469    Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".
470    """
471
472    limit: int  # Default is 25. Maximum is 1000
473    """
474    Maximum number of results to return. Default is 25, maximum is 1000.
475    """
476
477    offset: int  # Default is 0
478    """
479    Number of results to skip for pagination. Default is 0.
480    """
481
482    includemetadata: (
483        str  # Default is True, set to False to exclude metadata calculation
484    )
485    """
486    Whether to include metadata in the response. Default is True.
487    """

Parameters for querying the /data endpoint of the NOAA NCEI API v2.

datasetid: Required[str]

Required. A valid dataset ID.

datatypeid: str

Filter by data type ID(s). Can be a single value or multiple values separated by '&'.

locationid: str

Filter by location ID(s). Can be a single value or multiple values separated by '&'.

stationid: str

Filter by station ID(s). Can be a single value or multiple values separated by '&'.

startdate: Required[str]

Required. Beginning of date range in 'YYYY-MM-DD' format or 'YYYY-MM-DDThh:mm:ss' datetime format.

enddate: Required[str]

Required. End of date range in 'YYYY-MM-DD' format or 'YYYY-MM-DDThh:mm:ss' datetime format. Note: Annual and monthly data will be limited to a 10-year range while other data will be limited to a 1-year range.

units: Literal['standard', 'metric', '']

Unit conversion, either "standard" or "metric". Default is no conversion.

sortfield: Literal['datatype', 'date', 'station']

Field to sort results by. Options are "id", "name", "mindate", "maxdate", "datacoverage".

sortorder: Literal['asc', 'desc']

Sort direction, either "asc" (ascending) or "desc" (descending). Default is "asc".

limit: int

Maximum number of results to return. Default is 25, maximum is 1000.

offset: int

Number of results to skip for pagination. Default is 0.

includemetadata: str

Whether to include metadata in the response. Default is True.

Union type representing any valid NOAA API parameter dictionary. Can be one of:

  • DatasetsParameters
  • DatacategoriesParameters
  • DatatypesParameters
  • LocationcategoriesParameters
  • LocationsParameters
  • StationsParameters
  • DataParameters