API reference¶
Auto-generated from docstrings.
Client¶
sjvair.client.SJVAirClient ¶
HTTP client for the SJVAir API.
All resource objects (monitors, regions, calenviroscreen, ceidars,
hms, pesticides) are attached as attributes and share this client's session,
retry logic, and cooldown gate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str | None
|
API base URL. Defaults to |
None
|
timeout
|
int | None
|
Request timeout in seconds. Defaults to |
None
|
max_retries
|
int | None
|
Number of retries on 5xx / 429 responses. Defaults to 5. |
None
|
max_connections
|
int | None
|
Maximum concurrent requests (semaphore). Defaults to 4. |
None
|
api_key
|
str | None
|
Bearer token for authenticated endpoints. Defaults to |
None
|
Can be used as a context manager to ensure the underlying session is closed::
with SJVAirClient() as client:
monitors = list(client.monitors.list())
Source code in sjvair/client.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
get ¶
get(path, params=None)
GET path relative to base_url, with retry and cooldown.
Retries on 5xx up to max_retries times with exponential backoff.
On 429, triggers a shared cooldown that blocks all threads until the
wait expires. Raises :class:~sjvair.exceptions.NotFound on 404,
:class:~sjvair.exceptions.RateLimited after exhausting retries on 429,
and :class:~sjvair.exceptions.ServerError after exhausting retries on 5xx.
Source code in sjvair/client.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
Resources¶
sjvair.resources.monitors.MonitorsResource ¶
Bases: BaseResource
Access air quality monitor data.
Available on :attr:SJVAirClient.monitors.
Source code in sjvair/resources/monitors.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
list ¶
list(**params)
Iterate all monitors, optionally filtered by region_id, is_sjvair, etc.
Source code in sjvair/resources/monitors.py
44 45 46 | |
get ¶
get(monitor_id)
Get a single monitor by ID.
Source code in sjvair/resources/monitors.py
48 49 50 | |
meta ¶
meta()
Return field metadata for monitor entries (field names, units, etc.).
Source code in sjvair/resources/monitors.py
52 53 54 | |
entries ¶
entries(monitor_id, entry_type, **params)
Iterate paginated entries for one monitor and entry type (e.g. 'PM2.5').
Source code in sjvair/resources/monitors.py
56 57 58 | |
export ¶
export(monitor_id, start_date, end_date, scope='resolved')
Bulk-export entries for a monitor in a single request.
The server enforces a 180-day maximum window per call. Use
:class:~sjvair.export.engine.ExportEngine to download longer ranges
automatically by splitting into chunks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
monitor_id
|
str
|
Monitor UUID. |
required |
start_date
|
str
|
ISO 8601 date string ( |
required |
end_date
|
str
|
ISO 8601 date string ( |
required |
scope
|
str
|
|
'resolved'
|
Source code in sjvair/resources/monitors.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
summaries ¶
summaries(
monitor_id, entry_type, resolution, start_date, end_date
)
Iterate aggregated summaries for a monitor across the given date range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
monitor_id
|
str
|
Monitor UUID. |
required |
entry_type
|
str
|
Sensor field (e.g. |
required |
resolution
|
str
|
One of |
required |
start_date
|
str
|
ISO 8601 date string. |
required |
end_date
|
str
|
ISO 8601 date string. |
required |
Source code in sjvair/resources/monitors.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
closest ¶
closest(entry_type, lat, lon)
Return up to 3 nearest active monitors with distance and latest entry.
Source code in sjvair/resources/monitors.py
116 117 118 | |
current ¶
current(entry_type)
Iterate all active monitors with their most recent entry for the given type.
Source code in sjvair/resources/monitors.py
120 121 122 | |
sjvair.resources.regions.RegionsResource ¶
Bases: BaseResource
Access geographic region data (counties, cities, ZIP codes, census tracts).
Available on :attr:SJVAirClient.regions.
Source code in sjvair/resources/regions.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
list ¶
list(**params)
Iterate all regions, optionally filtered by kind, county, etc.
Source code in sjvair/resources/regions.py
19 20 21 | |
get ¶
get(region_id)
Get a single region by ID.
Source code in sjvair/resources/regions.py
23 24 25 | |
search ¶
search(query, **params)
Search regions by name, returning all high-confidence matches. Pass type= to scope to a specific region type.
Source code in sjvair/resources/regions.py
27 28 29 30 31 32 33 34 35 | |
lookup ¶
lookup(query, **params)
Resolve a name to the single best-match region. Pass type= to scope to a specific region type.
Source code in sjvair/resources/regions.py
37 38 39 40 41 42 | |
summaries ¶
summaries(
region_id, entry_type, resolution, start_date, end_date
)
Iterate aggregated summaries for a region. Same resolution options as :meth:MonitorsResource.summaries.
Source code in sjvair/resources/regions.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
sjvair.resources.calenviroscreen.CalEnviroScreenResource ¶
Bases: BaseResource
Access CalEnviroScreen 4.0 census tract cumulative impact scores.
Available on :attr:SJVAirClient.calenviroscreen.
Source code in sjvair/resources/calenviroscreen.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
list ¶
list(year, **params)
Iterate all census tract scores for the given data year.
Source code in sjvair/resources/calenviroscreen.py
16 17 18 | |
get ¶
get(year, tract)
Get CalEnviroScreen scores for a single census tract (FIPS code).
Source code in sjvair/resources/calenviroscreen.py
20 21 22 | |
sjvair.resources.ceidars.CEIDARSResource ¶
Bases: BaseResource
Access CEIDARS (California Emissions Inventory) facility data.
Available on :attr:SJVAirClient.ceidars.
Source code in sjvair/resources/ceidars.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
list ¶
list(**params)
Iterate all CEIDARS facilities.
Source code in sjvair/resources/ceidars.py
16 17 18 | |
get ¶
get(facility_id)
Get a single CEIDARS facility by ID.
Source code in sjvair/resources/ceidars.py
20 21 22 | |
years ¶
years()
Return the list of inventory years available in the dataset.
Source code in sjvair/resources/ceidars.py
24 25 26 | |
sjvair.resources.hms.HMSResource ¶
Bases: BaseResource
Access NOAA Hazard Mapping System (HMS) smoke and fire data.
Available on :attr:SJVAirClient.hms. Sub-resources:
- :attr:
smoke— smoke plume polygons - :attr:
fire— fire detection points
Source code in sjvair/resources/hms.py
36 37 38 39 40 41 42 43 44 45 46 47 48 | |
sjvair.resources.pesticides.PesticidesResource ¶
Bases: BaseResource
Access California Department of Pesticide Regulation (CDPR) pesticide data.
Available on :attr:SJVAirClient.pesticides. Sub-resources:
- :attr:
chemicals— active ingredient lookup - :attr:
commodities— crop/commodity lookup - :attr:
products— registered product lookup - :attr:
use— pesticide use reports - :attr:
notice— pesticide use notices
Source code in sjvair/resources/pesticides.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
region_use ¶
region_use(region_id, **params)
Iterate pesticide use reports for a specific region.
Source code in sjvair/resources/pesticides.py
70 71 72 | |
region_notice ¶
region_notice(region_id, **params)
Iterate pesticide use notices for a specific region.
Source code in sjvair/resources/pesticides.py
74 75 76 | |
region_summary ¶
region_summary(region_id)
Return an aggregate pesticide use summary for a region.
Source code in sjvair/resources/pesticides.py
78 79 80 | |