This script set gets data from the National Interagency Fire Center Public View - Interagency Remote Automatic Weather Stations (RAWS) and formats a placefile for GRLevelX software to display icons for Remote Automatic Weather Stations (RAWS), and mouse-over popups with text for the current observation from the RAWS.
One script is to run via cron to gather the data routinely (get-RAWS-data.php).
The RAWS.php script is to be accessed by including the website URL in the GRLevelX placefile manager window.
This script reads the GIS JSON data from NIFC ESRI Feature server with RAWS data and creates the RAWS-data-inc.php file which contains the parsed and formatted RAWS data for each RAWS.
It should be run by cron every 5 minutes to keep the data current. Keep in mind that many RAWS report only once per hour at irregular times so loading more often won't result in 'new' data.
This script generates a GRLevelX placefile from the RAWS-data-inc.php file on demand by a GRLevel3 instance. It will return RAWS icons with popup info for each RAWS within 250 miles of the current radar selected in GRLevel3. It requires the following file:
- RAWS-data-inc.php (produced by get-RAWS-data.php for the current RAWS data)
The script uses 2 icon files: RAWS-icons.png and windbarbs-kt-white.png
If you run the script for debugging in a browser, add ?version=1.5&dpi=96&lat={latitude}&lon={longitude}
to
the RAWS.php URL so it knows what to select for display.
Additional documentation is in each script for further modification convenience.
Upload the following files in a directory under the document root of your website. (We used 'placefiles' in the examples below)
- get-RAWS-data.php
- RAWS.php
- windbarbs-kt-white.png
- RAWS-icons.png
Set up cron to run get-RAWS-data.php like:
*/5 * 1 * * * cd $HOME/public_html/placefiles;php -q get-RAWS-data.php > RAWS-status.txt 2>&1
be sure to change the public_html/placefiles to the directory where you installed the scripts.
Run the script once (to generate data) by https://your.website.com/placefiles/get-RAWS-data.php
Then you can test the RAWS placefile script by using your browser to go to
https://your.website.com/placefiles/RAWS.php?version=1.5&dpi=96&lat=37.0&lon=-122.0
If that returns a placefile, then add your placefile URL into the GRLevelX placefile manager window.
get-RAWS-data.php V1.00 - 28-Sep-2023 - [email protected]
.. Loaded https://services3.arcgis.com/T4QMspbfLg3qTGWY/arcgis/rest/services/PublicView_RAWS/FeatureServer/1/query?f=json&maxRecordCountFactor=4&resultOffset=0&resultRecordCount=8000&where=1%3D1&orderByFields=OBJECTID&outFields=*&spatialRel=esriSpatialRelIntersects
which has 2672083 bytes.
.. saved raw JSON data to RAWS_data.json.
.. JSON decode - No errors
.. saved RAWS-data-inc.php with 1212 RAWS entries.
.. Done
; placefile with conditions generated by RAWS.php V1.00 - 28-Sep-2023 - [email protected]
; Generated on Thu, 28 Sep 2023 13:31:30 +0000
;
Title: NIFC RAWS Observations - Thu, 28 Sep 2023 13:31:30 +0000 - Saratoga-Weather.org
Refresh: 5
Color: 255 255 255
Font: 1, 12, 1, Arial
IconFile: 1, 19, 43, 2, 43, windbarbs-kt-white.png
IconFile: 2, 17, 17, 8, 8, RAWS-icons.png
Threshold: 999
; generate MMFO3 MUTTON MOUNTAIN at 44.925480,-121.197700 at 206 miles SE
Object: 44.925480,-121.197700
Threshold: 999
Icon: 0,0,242,1,1
Text: -17, 13, 1, 42
Text: -17, -13, 1, 38
Color: 2 145 255
Text: -30, 0, 1, 38
Color: 255 255 255
Icon: 0,0,000,2,4,"MMFO3 (MUTTON MOUNTAIN)\n (44.925480,-121.197700 @ 4011 ft)\nCounty: Wasco, OR\n----------------------------------------------------------\nTime: Thursday, Sep 28 (12:34Z)\nAge: 2418 secs\nTemp: 42 F\nHum: 87%\nTdp: 38 F\nRain: 6.69 in (accum. total)\nWind: WSW 6 mph\n high 12 mph from SW\nSolar: 0 W/m2\n\nWind Chill: 38 F\n\nOwner: BIA,Warm Springs Agency, \nSite: SITE IS SITUATED IN A SMALL CLEARING WITHIN THE MUTTON MTN RANGE OVERLOOKING A VALLEY TO THE SW. MUTTON MTN IS 2 MILES TO THE W. MUTTON MTN SPRING IS 4 MILES TO THE NE. SHANIKO BUTTE IS 4 MILES TO THE N. VEGETATION IS PINE W/SMALL SHRUBS AREA BIA FREQS = S-172.425, R-171.775, CODE-4321\n----------------------------------------------------------"
End:
; generate STRW1 STEHEKIN-AIRSTRIP at 48.346940,-120.720280 at 179 miles ENE
Object: 48.346940,-120.720280
Threshold: 999
Text: -17, 13, 1, 47
Text: -17, -13, 1, 47
Icon: 0,0,000,2,4,"STRW1 (STEHEKIN-AIRSTRIP)\n (48.346940,-120.720280 @ 1230 ft)\nCounty: , WA\n----------------------------------------------------------\nTime: Thursday, Sep 28 (13:01Z)\nAge: 808 secs\nTemp: 47 F\nHum: 100%\nTdp: 47 F\nTfuel: 45 F\nFmoist:26%\nRain: 15.29 in (accum. total)\nWind: ESE 1 mph\n high 5 mph from SW\nSolar: 0 W/m2\n\nOwner: NPS,NORTH CASCADES NP, \nSite: n/a\n----------------------------------------------------------"
End:
Special thanks to Mike Davis, W1ARN of the National Weather Service, Nashville TN office for his testing/feedback during development.