pwfdf query¶
Synopsis¶
pwfdf query [options]
Description¶
Sends a single PWFDF search query to the ScienceBase API and returns the response.
Warning
Most users should use the sbjson command instead of this command. This command is intended for advanced developers who need to troubleshoot the ScienceBase API, or who want to implement custom paging schemes.
Note that this command returns the raw response JSON, rather than extracting the sbJSON item entries. Also, this command only ever performs a single API query. So if the search results would require multiple queries (pages) to load, then the output will only contain the first page of search results.
Options¶
- -h, --help¶
Displays the command’s help text and exits.
- -t, --show-traceback¶
Shows the full traceback when an error occurs.
Date Ranges¶
- --start-date DATE | DATE RANGE¶
A date or date range in when the fire started.
Examples:
pwfdf query --start-date 2025 pwfdf query --start-date 2025-06 pwfdf query --start-date 2025-06-11 pwfdf query --start-date 2025 2027 pwfdf query --start-date 2025-06-15 2025-08-10
- --assessment-date DATE | DATE RANGE¶
A date or date range in which the assessment was conducted.
Examples:
pwfdf query --assessment-date 2025 pwfdf query --assessment-date 2025-06 pwfdf query --assessment-date 2025-06-11 pwfdf query --assessment-date 2025 2027 pwfdf query --assessment-date 2025-06-15 2025-08-10
- --publication-date DATE | DATE RANGE¶
A date or date range in which the assessment was published to ScienceBase.
Examples:
pwfdf query --publication-date 2025 pwfdf query --publication-date 2025-06 pwfdf query --publication-date 2025-06-11 pwfdf query --publication-date 2025 2027 pwfdf query --publication-date 2025-06-15 2025-08-10
Extent¶
Options for searching well-known spatial regions whose coordinates are already known by ScienceBase.
- --extent NAME¶
The name of an extent (such as a state or country) to search. Place the name in quotes if it contains spaces or punctuation. Cannot be used if the
--extent-idoption is used.Examples:
# Named extents pwfdf query --extent California pwfdf query --extent "Los Angeles, CA" pwfdf query --extent "Grand Canyon National Park" # Hydrologic unit codes pwfdf query --extent 05
- --extent-id ID¶
The ID of an extent to search. Cannot be used if the
--extentoption is used.Example:
# Searches California pwfdf query --extent-id 35 # Searches the 05 HUC-2 watershed pwfdf query --extent-id 2000387
- --extent-type TYPE¶
The type of extent to search. This option is usually not necessary, but can guard against searching a wrong extent with a similar name.
Tip
Use the pwfdf extents types command to obtain a list of supported types.
Example:
pwfdf query --extent "Los Angeles, CA" --extent-type "U.S. County"
- --extent-relation RELATION¶
The spatial relationship between the extent and the search results. Options are:
Relation
Description
intersects(default)Matches assessments that intersect the extent at any point.
withinMatches assessments that are fully contained within the extent.
disjointMatches assessments that do not intersect the extent at any point.
Example:
pwfdf query --extent California --extent-relation within
Geometry¶
Custom geospatial searches in which you provide the coordinates of the region to search.
- --bbox PATH | "XMIN, YMIN, XMAX, YMAX"¶
A bounding box to search. Usually the path to a supported GIS file, such as a Shapefile or GeoJSON. May also be a comma-delimited, WGS-84
"XMIN, YMIN, XMAX, YMAX"coordinate sequence. If a GIS file, then the bounding box is calculated from the contained geometries.Examples:
pwfdf query --bbox path/to/my/file.shp pwfdf query --bbox "-121, 32, -119, 34"
- --point PATH | "LON, LAT"¶
A geospatial point to search. Either a comma-delimited
"LON, LAT"sequence, or the path to a supported GIS file, such as a Shapefile or GeoJSON. If a GIS file, then the point is calculated as the center of the bounding box for the contained geometries.Examples:
pwfdf query --point path/to/my/file.shp pwfdf query --point "-121, 32"
- --geometry PATH | GEOJSON¶
A spatial geometry to search. Usually the path to a file in a supported GIS file, such as a Shapefile or GeoJSON. May also be a valid WGS-84 GeoJSON geometry string, but this syntax is generally not recommended, as it is difficult to use in practice.
In practice, only relatively coarse geometries are supported, as the geometry cannot cause the underlying query URL to exceed 2000 characters. As a rule of thumb, geometries with fewer than 100 coordinate points are expected to usually work.
Examples:
pwfdf query --geometry path/to/my/file.shp pwfdf query --geometry "{\"type\":\"Point\",\"coordinates\":[-121, 32]}"
- --geometry-relation RELATION¶
The spatial relationship between a geospatial search and the search results. Options are:
Relation
Description
intersects(default)Matches assessments that intersect the geometry at any point.
withinMatches assessments that are fully contained within the geometry.
disjointMatches assessments that do not intersect the geometry at any point.
Example:
pwfdf query --bbox my-file.shp --geometry-relation intersects pwfdf query --point my-file.shp --geometry-relation within pwfdf query --geometry my-file.shp --geometry-relation disjoint
Geometry File IO¶
Options for reading geometries from supported vector feature file formats.
- --geometry-layer NAME¶
The name of a data layer in the GIS file from which to extract the geometry. Cannot be used when the
--geometry-indexoption is used.Example:
pwfdf query --geometry my-file.geojson --geometry-layer "My Data Layer"
- --geometry-index INDEX¶
The index of a data layer in the GIS file from which to extract the geometry. Cannot be used when the
--geometry-layeroption is used.Example:
pwfdf query --geometry my-file.geojson --geometry-index 2
- --geometry-driver DRIVER¶
Specifies the file format driver to use to open the geometry file. Note that the format driver is usually auto-detected from the file extension. Use this option if the geometry file uses a non-standard file extension. Refer to the first column of the geometry file formats table for a list of supported driver names.
Example:
pwfdf query --geometry my-file.unusual --geometry-driver Shapefile
- --geometry-encoding ENCODING¶
Specifies the file encoding to use to read the geometry file. Note that the encoding is auto-detected for most formats.
Example:
pwfdf query --geometry my-file.shp --geometry-encoding Windows-1252
Misc ScienceBase¶
Miscellaneous options for low-level interactions with the ScienceBase API.
- --fields FIELD...¶
Specifies the sbJSON fields that should be queried.
Example:
pwfdf query --fields id title summary
- --max N¶
The maximum number of ScienceBase products retrieved per API query. Defaults to 500 and cannot exceed 1000.
Example:
pwfdf query --max 1000
- --offset N¶
The number of ScienceBase products to skip before retrieving search results.
Example:
pwfdf query --offset 50
- --timeout SECONDS¶
Specifies the maximum allowed amount of time to connect with the ScienceBase server. Raises an error if the command cannot connect in this time frame. Defaults to 15 seconds.
Example:
pwfdf query --timeout 60
Logging¶
- -q, --quiet¶
Do not log progress messages to the console.
Example:
pwfdf query -q
- -v, --verbose¶
Prints more detailed progress messages to the console. (Useful for debugging).
Example:
pwfdf query -v
- --log PATH¶
Logs detailed progress to the indicated file
Example:
pwfdf query --log my-file.log