Query Endpoint
Base URL:http://modms.devops.arabiaweather.com/q
Query Parameters
Fields
Specify which variables to retrieve using thefields parameter:
time: Timestamp for each data pointlocation: Geographic coordinates (latitude, longitude)MODEL.VAR: Model variable in formatMODEL.LEVEL.VARIABLE
| (pipe with spaces)
Time Range
Specify time range using thetime parameter:
- Unix timestamp:
1762355295 now: Current time- STEP: Time interval for interpolation (e.g.,
60 minutes)
Location
Specify geographic location using thelocation parameter:
(lat, lon) with decimal degrees
Variable Format
Variables follow the pattern:MODEL.LEVEL.VARIABLE
Examples:
GFS.ATM.TCDC- GFS total cloud coverGEM.GND2M.TMP- GEM 2m temperatureUK10.GND10M.UGRD- UK10 10m U-wind componentICON.SFC.APCP.HR- ICON hourly precipitation
GFS- Global Forecast SystemGEM- Global Environmental MultiscaleUK10- UK Met OfficeICON- ICOsahedral NonhydrostaticWRFME- WRF Middle EastEC25- ECMWFAIFS- AIFS model
Model Run Specification
You can specify a particular model run using the@ syntax:
ModMS (Main Server):
MODEL.LEVEL.VARIABLE- Uses the latest available runMODEL@model-run.LEVEL.VARIABLE- Specifies a specific model run (e.g.,GFS@2218)
MODEL@timestamp.LEVEL.VARIABLE- Must use Unix timestamp format (e.g.,GFS@1766577600)
- ModMS:
GFS@2218.ISO200HPA.UGRD(model run format) - MAMS:
GFS@1766577600.ISO200HPA.UGRD(timestamp format) - ModMS:
GFS.ISO200HPA.UGRD(uses latest available run)
Mathematical Expressions
ModMS supports complex mathematical expressions in queries using the muparser library and custom functions.Basic Math Operations
Standard arithmetic operations:+- Addition-- Subtraction*- Multiplication/- Division%- Modulo (viamod()function)^- Power
Comparison Operators
==- Equal!=- Not equal>- Greater than<- Less than>=- Greater than or equal<=- Less than or equal&&- Logical AND||- Logical OR (viaor()function)
Conditional Expressions
Ternary operator for conditional logic:Built-in Functions
Aggregation Functions
min(value1, value2, ...)
- Returns minimum value, ignoring NaN
max(value1, value2, ...)
- Returns maximum value, ignoring NaN
avg(value1, value2, ...)
- Returns average of values, ignoring NaN
median(value1, value2, ...)
- Returns median value (up to 15 values), ignoring NaN
Model Merging Functions
merge(value1, value2, ...)
- Returns first non-NaN value from left to right
- Used to combine multiple model sources with fallback
cmerge(time, value1, lastTime1, value2, lastTime2, ...)
- Time-weighted merge based on model freshness
- First parameter is current time
- Then pairs of (value, last_available_time)
- Weights models by how recent their data is
Wind Functions
speed(u, v)
- Calculates wind speed from U and V components
- Formula:
sqrt(u² + v²)
dir(u, v)
- Calculates wind direction from U and V components
- Returns direction from north in degrees (0-360)
Meteorological Functions
rh(temp, dewpoint)
- Calculates relative humidity from temperature and dewpoint
- Both parameters in Kelvin
dpt(temp, rh)
- Calculates dewpoint from temperature and relative humidity
Consensus Functions
consensus(value1, value2, ...)
- Finds longest chain of similar values and returns average
- Used for model ensemble consensus
consensusT(threshold, value1, value2, ...)
- Consensus with threshold - groups values above/below threshold
- First parameter is threshold value
consensusL(maxDiff, value1, value2, ...)
- Linear consensus with maximum difference parameter
- First parameter is maximum allowed difference
confidenceGT(threshold, value1, value2, ...)
- Returns confidence (0-1) that values are above threshold
confidenceBT(threshold, value1, value2, ...)
- Returns confidence (0-1) based on threshold comparison
Filter Functions
filter(value, currentTime, maxTime)
- Returns value only if currentTime is less than maxTime, else NaN
filter(value, currentTime, minTime, maxTime)
- Returns value only if minTime is less than or equal to currentTime and currentTime is less than maxTime, else NaN
Utility Functions
nearest(target, value1, value2, ...)
- Returns value closest to target
nearestxy(target, x1, y1, x2, y2, ...)
- Returns y-value whose x-value is closest to target
or(value1, value2, ...)
- Logical OR - returns first truthy value
fzero(x1, y1, x2, y2, ...)
- Finds zero crossing point between data points
mod(value, divisor)
- Modulo operation
Unit Conversion
conv("unit1>unit2", value)
- Converts between units using UDUNITS library
- Example:
conv("kelvin>celsius", GFS.GND2M.TMP)
Query Capabilities
1. Single Model Queries
Query data from a single model:2. Multi-Model Merging
Combine multiple models with fallback:3. Model Averaging
Average values from multiple models:4. Model Median
Get median from multiple models:5. Conditional Calculations
Use conditional logic based on conditions:6. Derived Variables
Calculate derived meteorological variables:7. Time-Based Filtering
Filter values based on time constraints:8. Time-Weighted Merging
Merge models based on data freshness:9. Ensemble Consensus
Get consensus from multiple model runs:10. Unit Conversions
Convert between units:Time Step Interpolation
TheSTEP parameter enables time interpolation to get data at regular intervals:
Syntax:
minutes- Minutes (e.g.,60 minutesfor hourly)hours- Hoursdays- Days
now and the end timestamp, interpolating values from available model timesteps.
Use STEP when you need regular time intervals (e.g., hourly data) but the model only provides data at irregular timesteps.
URL Encoding
When constructing URLs manually, remember to URL-encode special characters:- Space:
%20 - Pipe:
%7Cor|(usually works) - Comma:
%2Cor,(usually works) - Parentheses:
%28(and%29)
Related Documentation
- API Examples - Practical query examples
- ModMS Overview - System overview
- ModMS Architecture - System architecture

