A delegation language to request weather products
and a scheme of its interpretation

 

A poster presentation at the 1998 International Conference on Functional Programming (ICFP'98)
Mt. Washington Conference Center, Baltimore, MD, 27-29 September 1998

 

What is Metcast

Metcast serves:
 

Metcast's Request Language

This is a language a Metcast client uses to communicate its wishes to a server in a POSTed request. This language:
 

Examples

Three request language phrases:
     (some-area
     	(bounding-box  90.0 178W -90.0 179E)
     	(source FNMOC)
     	(model NOGAPS)(resolution 1.0)
     	(products
     	  ((geopotential-height)
     		(layer isobar 500)(tau 6))
     	  ((geopotential-height)
     		(layer msl)(tau 6))
     	  ((temperature)
     		(layer isobar 1000)(tau 6)
	     	(model NORAPS))
	      (METAR) (SIGMET)))

     (Area51
       (use special-area-51))

     (Area51
       (use special-area-51) (user 007)
       (products (TAF)))


Implementation

  1. "Compilation"
  2. "Interpretation"
  3. Execution

Walk through a sample transaction

Initial Request

     (some-area
       (bounding-box  90.0 178W -90.0 179E)
       (model NOGAPS)(resolution 1.0)
       (products
         (geopotential-height
            (layer isobar 500)(tau 12))
         (temperature
            (source NOAA)
            (model NOGAPS) (layer msl))))

Note a (object-name argument...) format of each sentence in the request. When a server internalizes -- compiles -- a sentence, it looks up a constructor named OBJ-LOADER:object-name in the current environment, and applies this constructor to the argument.... In other words, the server un-serializes each object mentioned in the request.

Initial Stack

This is the initial environment of the server, which specifies global defaults for every request
     (OBJ-LOADER:products . #<procedure #x1006ECB3>)
     (OBJ-LOADER:bounding-box . #<procedure #x1006ECA8>)
     (OBJ-LOADER:model . #<procedure #x1006EC00>)
     (OBJ-LOADER:source . #<procedure #x1006EBF5>)
     (executor . #<procedure serve-grids>)
     (center-id . 58)
     (process-id . 58)
     (resolution . 1.)
     (grid-id . 240)
     (pressure (product-GRIB-code . 1))
     (geopotential-height (product-GRIB-code . 7))
     (temperature (product-GRIB-code . 11))
     (GlobalWarnings
       (executor . #<procedure serve-global-warnings>))
     (SIGMET
       (executor . #<procedure perform-SIGMET-request>)
              (mime-type . "text/x-omf-advisories"))
     (|Env Name Key!| . "*** initial env ***"))

After the Stack-Compilation

This is the current environment after the sample request has been precompiled and its objects loaded
     (products
       (geopotential-height (layer isobar 500) (tau 12))
       (temperature (source NOAA) (model NOGAPS)
         (layer msl)))

		;  the top-level request context
      (resolution . 1.)	; request defaults

      (process-id . 58)	; model defaults

      (resolution . 2.5)
      (grid-id . 223)

		; Note an internal format of the bounding-box
      (bounding-box . #(90. -178. -90. 179.))
      (area-id . some-area)

		;  inherited from the standard prelude
      (OBJ-LOADER:products . #<procedure #x1006ECB3>)
      (center-id . 58)
      (process-id . 58)
      (resolution . 1.)
      (grid-id . 240)
	; etc., see above

Processing the first request

After the submitted request has been compiled, the server turns its attention to product request clauses, and recursively stack-compiles them. This is how the stack looks after the first product request has been fully loaded:
     ((tau . 12)			; product specs
      (layer isobar 500)
      (product-GRIB-code . 7)		; ... means geopotential-height
       (g3)		; mark!

      (products
        (geopotential-height (layer isobar 500) (tau 12))
        (temperature (source NOAA) (model NOGAPS)
     	 (layer msl)))

		; inherited from the top-level request context
      (resolution . 1.)		; request defaults
      (process-id . 58)		; model defaults
      (resolution . 2.5)
      (grid-id . 223)

      (bounding-box . #(90. -178. -90. 179.))
      (area-id . some-area)
        ...
      (center-id . 58)		; global defaults
      (process-id . 58)
      (resolution . 1.)
      (grid-id . 240)

     (geopotential-height (product-GRIB-code . 7))
     (temperature (product-GRIB-code . 11))
     (|Env Name Key!| . "*** initial env ***"))

Using this environment, the following database query is issued:

     AREA_ID=some-area
     MODIFIED_SINCE=0
     BOUNDING_BOX=90. -178. -90. 179.
     OUTPUT_FILE=/var/tmp/baaa12089
     PARAMETER=7
     CENTER=58 0 58
     LAYER=100 500
     GRID_ID=223
     TAU=12
     RESOLUTION=1. 1.
Some database keys (set in bold) are specified several times in the environment, within defaults of different depth. The most specific -- the least default -- value is chosen for the query.
 

Interpreting the temperature request

The second product request is processed similarly. The server compiles it and loads in the environment:
     ((layer . msl)			; product specs
      (process-id . 58)
      (resolution . 2.5)
      (grid-id . 223)			; model defaults

      (center-id . 59)
      (subcenter-id . 0)
      (product-GRIB-code . 11)	; ... means temperature

      (g4)	; mark!
      ...
      (resolution . 1.)			; request defaults

      (process-id . 58)			; model defaults

      (resolution . 2.5)
      (grid-id . 223)
      (bounding-box . #(90. -178. -90. 179.))
      (area-id . some-area)
      ...
      (center-id . 58)			; global defaults

      (process-id . 58)
      (resolution . 1.)
      (grid-id . 240)
       ...
      (|Env Name Key!| . "*** initial env ***"))

This environment is then used to look up all the necessary keys for the query:

     AREA_ID=some-area
     MODIFIED_SINCE=0
     BOUNDING_BOX=90. -178. -90. 179.
     OUTPUT_FILE=/var/tmp/daaa12089
     PARAMETER=11
     CENTER=59 0 58
     LAYER=102
     GRID_ID=223
     TAU=0
     RESOLUTION=2.5 2.5
Note that the environment contains not only simple values but procedures as well, which may add new or shadow old bindings in the environment.

 


REFERENCES

A one-page abstract of this presentation [.ps.gz, 5K]

Metcast home page
http://www.metnet.navy.mil/Metcast/

Request Language specification
http://www.metnet.navy.mil/Metcast/Request-Lang.html

Vocabulary package, (poly/homo)morphic dictionaries with a dynamic "inheritance" path

Hierarchical repository in Scheme
that implements the request language "stack"

Metcast Server URL
http://www.metnet.navy.mil/cgi-bin/oleg/server


Last updated October 9, 1998

This site's top page is http://pobox.com/~oleg/ftp/

oleg-at-pobox.com or oleg-at-okmij.org
Your comments, problem reports, questions are very welcome!