Snippets
A Snippet is a pre-set chunk of code that can provide the user with the javascript and html markup necessary to display maps from EWX on any webpage with data tailored to the user's needs.
Contents
Example
Below is an example of a Snippet that was generated using the EWX Map Snippet Configurator.
<script src="http://ewx.chg.ucsb.edu/ewx-snippets/ewxmap/ewxmap.js"></script>
<div id="ewx-map-00pz63b0tc"></div> <script> new EwxMap ({ ewxUrl: 'http://ewx.chg.ucsb.edu:8080/EWX', id: 'ewx-map-00pz63b0tc', dataset: 'chirps', region: 'africa', periodicity: '1-dekad', period: { year: 2016, month: 2, dekad: 3 }, showDekadControl: true, showYearControl: true, units: 'mm', statistic: 'data', width: 427, height: 455, zoom: 3, center: [1.5, 17], }); </script>
Snippets Parameters
ewxUrl
Currently, the only supported parameter is 'http://ewx.chg.ucsb.edu:8080/EWX'. However, other options are forthcoming.
id
This parameter can either be arbitrarily set by the user or, using the EWX Map Snippet Configurator, an id of 'ewx-map-[random]' will be generated for each configuration, where [random] is a randomly assigned collection of letters and numbers.
dataset
The dataset parameter defines which dataset the Snippet map will draw from. Certain other parameters may be available or unavailable depending on the data within the dataset. EWX Map Snippet Configurator adjusts to reflect this during configuration.
Data are automatically updated based on what is available through EWX. Currently, the available datasets include:
Dataset id | Notes |
---|---|
b1irtmax | B1-IRTmax (from B1 back to 1980, every three hours) |
chirp | Climate Hazards Group InfraRed Precipitation |
chirps | Climate Hazards Group InfraRed Precipitation with Station data |
chirpsclim | The Climate Hazards Group's Precipitation Climatology |
chirpsdecorr | CHIRP decorrelation distance |
chirpsprelim | CHIRPS prelimary data (GTS and Conagua (Mexico) station data only) |
cpcirtmax | CPC-IRTmax (from CPC back to 2000, every half hour) |
eancmet | East Africa evapotranspiration data using NOAA, CHIRPS, and MERRA |
eancml1soilm | East Africa first layer soil moisture data using NOAA, CHIRPS, and MERRA |
eancmrunoff | East Africa runoff data using NOAA, CHIRPS, and MERRA |
eancmrunoff001 | East Africa runoff data using NOAA, CHIRPS, and MERRA |
eancmta | East Africa air temperature data using NOAA, CHIRPS, and MERRA |
eanrget | East Africa evapotranspiration data using NOAA and information needed |
eanrgl1soilm | East Africa first layer soil moisture data using NOAA and information needed |
eanrgrunoff | East Africa runoff data using NOAA and information needed |
eanrgta | East Africa air temperature data using NOAA and information needed |
eavcmet | East Africa evapotranspiration data using the Vic Model, CHIRPS, and MERRA |
eavcml1soilm | East Africa first layer soil moisture data using the Vic Model, CHIRPS, and MERRA |
eavcmrunoff | East Africa runoff data using the Vic Model, CHIRPS, and MERRA |
eavcmta | East Africa air temperature data using the Vic Model, CHIRPS, and MERRA |
gpccdi | GPCC drought index |
lst | land surface temperature |
rchecksstns | CHIRPS reality-check stations - 11x11 pixel of station value at station location, superimposed on CHIRPS field (CHIRPS final - used in rchecks) |
rfe2 | CPC rainfall estimate (version 2) |
trmm | Tropical Rainfall Measuring Mission |
wrsilongmaize | WRSI derived long rains data, using maize (uses end of season) |
wrsishortmaize | WRSI derived short rains data, using maize (uses end of season) |
region
"regionName": "Western Africa"
"regionId": "westernafrica"
"bounds": [5.0, -17.25], [18.0, 25.25]
"regionName": "Eastern Africa"
"regionId": "easternafrica"
"bounds": [-12.0, 21.75], [23.25, 51.25]
"regionName": "Western Hemisphere"
"regionId": "whem"
"bounds": [-50.0, -130.0], [50.0, -30.0]
"regionName": "Southern Africa"
"regionId": "southernafrica"
"bounds": [-34.75, 5.75], [7.0, 51.25]
"regionName": "Global"
"regionId": "global"
"bounds": [-90.0, -180.0], [90.0, 180.0]
"regionName": "Asia"
"regionId": "asia"
"bounds": [5.0, 40.0], [57.0, 147.0]
"regionName": "Africa"
"regionId": "africa"
"bounds": [-40.0, -20.0], [40.0, 55.0]
"regionName": "United States"
"regionId": "usa"
"bounds": [23.0, -130.0], [50.0, -63.0]
periodicity
More are forthcoming, but for now the available parameters are below:
- '1-dekad'
- '1-month'
- '2-month'
- '3-month'
period
- { year: yyyy, month: m, dekad: 3 } = Full year, numerical month (1-12), with a default dekad of 3 (based on monthly, not yearly dekad, if dekad info is available)
- latest = Latest check box is checked (this parameter will display the latest data for the indicated dataset)
showDekadControl
A simple boolean parameter - true if the Dekad box is checked, false if not
showYearControl
A simple boolean parameter - true if Year box is checked, false if not
units
- 'mm'
- 'c-deg'
- 'none'
statistic
- anomaly
- data
- z-score
width
Width defaults to 427 and is based on pixels. Width can be adjusted either by resizing the window in the configurator or by manually entering the desired value.
height
Height defaults to 455 and is based on pixels. Width can be adjusted either by resizing the window in the configurator or by manually entering the desired value.
zoom
Zoom defaults to a value of 3. Zoom can be adjusted by using the +/- buttons on your keyboard or your mouse wheel while your mouse cursor is over the snippet map, or by manually setting the value in the javascript snippet.
center
The center value defaults to [1.5, 17] and can be adjusted either by clicking and dragging within the window in the configurator or by manually entering the desired value.