Home
Latest News
Downloads
Repositories

Docs
Quick guide
Wiki
Npemwin manual
Article for Geo Quarterly
Live
Nbsp Live
Npemwin Live
Npstats Live
Signal Monitor
Related Sites
OpenNoaaport
iNoaaport
| Pool
iEmwin | Pool

Support
Problem reports
Group
Contact


Exporter

The exporter module, which is enabled by default, allows client programs to query the server and retrieve the data files by http. The api consists of just three commands that are sent to the server by http. The results of the queries can be returned in an easy to parse format in plain text or xml.

The module is complemented by three additional commands, which are part of the batch module but are mentioned here for completeness. These three commands act on the raw data files that are saved in the spool directory, while the three exporter commands work on the data files that have been processed by the filters. The exporter commands are explained immediately below and the spool commands are explained next.

The exporter commands are:

http://server:port/command
where command is one of the following:
/_export/query_list?select=regexp[&format=xml|csv]
/_export/query_dir?dir=dir&select=regexp[&format=xml]
/_export_get/dir/file

The ``select'' parameter regexp is a regular expression (as explained below) that gives a simple and powerful method to query and select the files of interest. The ``format'' parameter instructs the server to return the information in xml format (more on that below).

The module is designed to be simple, convenient and powerful for scripts and special applications, rather than for interactive use through web browsers.

For example, using our own test server,

http://www.opennoaaport.net:8015/_export/query_list?select=nwx
http://www.opennoaaport.net:8015/_export/query_list?select=nwx&format=xml
http://www.opennoaaport.net:8015/_export/query_dir?dir=digatmos/nwx/watch_warn/flw&select=20081211
http://www.opennoaaport.net:8015/_export/query_dir?dir=digatmos/nwx/watch_warn/flw&select=20081211&format=xml
http://www.opennoaaport.net:8015/_export_get/digatmos/nwx/watch_warn/flw/2008121115.flw

The query_list command

/_export/query_list?select=regexp[&format=xml|csv]
takes one or two arguments. The "select" argument is a regular expression that is matched against the list of subdirectories that contain the data files. The first few subdirectories are,
digatmos/surface
digatmos/nwx/public_products
digatmos/upperair
and there are many (300+) more. For example,
/_export/query_list?select=nwx/public_products
will match the directories
digatmos/nwx/pub_prod/rws
digatmos/nwx/pub_prod/afm
digatmos/nwx/watch_warn/flw
and many others. Then the server will return the list
Public_Products,digatmos/nwx/pub_prod/rws,%{ymdh}.rws
Public_Products,digatmos/nwx/pub_prod/afm,%{ymdh}.afm
Watch_and_Warning_Products,digatmos/nwx/watch_warn/flw,%{ymdh}.flw
and so on. Each item that matches contains the comma separated trio of elements,
description of the data
subdirectory
name format of the data file
For example, the %{ymdh}.fwl in the third line above means that the subdiretory ``digatmos/nwx/watch_warn/flw'' contains files named like
2008121121.fwl
2008121122.fwl
2008121123.fwl
If the second argument (format=xml) is given, that is
/_export/query_list?select=nwx/public_products&format=xml
then the list will be returned in xml format instead of a comma separated trio in each line.

The query_dir command can also take two arguments

/_export/query_dir?dir=dir&select=regexp[&format=xml|csv]
For example, with just one argument,
/_export/query_dir?dir=digatmos/nwx/watch_warn/flw&select=20081211
it will return the list of files in the subdirectory
digatmos/nwx/watch_warn
whose names match the regular expression that is passed in the ``select'' parameter. In this example, it will return a list like
2008121100.flw
2008121101.flw
2008121102.flw
and so on. A command like
/_export/query_dir?dir=digatmos/nwx/watch_warn/flw&select=2008121[12]
will return the list of files on days 11 and 12, and a command like
/_export/query_dir?dir=digatmos/nwx/watch_warn/flw&select=200812110[1-4]
will return the list corresponding to 2008-12-11 between 1 and 4 am. In any case, if the second parameter is used, like
/_export/query_dir?dir=digatmos/nwx/watch_warn/flw&select=20081211&format=xml
then the list is returned in xml format.

The _export_get command is used to retrieve a particular file. For example

http://www.opennoaaport.net:8015/_export_get/digatmos/nwx/watch_warn/flw/2008121115.flw
will return that particular data file.

In summary, the query_list command is used to get the list of data subdirectories and the format of the file names. The select parameter is used to restrict the set of subdirectories.

The query_dir command is used to get the list of data files in a given subdirectory. The select parameter restricts the date and times of the set of files.

Finally the export_get command is used to retrieve a particular file from a particular data subdirectory.

The meaning of a ``format tag'' like %{ymdh} in the file names of the ist returned has been explained above. Other tags that are used with a similar meaning are

%{ymdh_mh}
%{wmoid}
%{awips}
%{awips1}
%{awips2}
which have values like
20081211_1045
fous41
n0rjua
n0r (first three letters of %{awips})
jua (last three letters of %{awips})
respectively.

At the moment of writing, only the data subdirectories of the digatmos directory are exported. Other ditectories (e.g., gempak) will be included as the module is developed further.

Spool commands

The spool commands are

http://server:port/command
where command is one of
http://server:port/_get/spool/fname
http://server:port/_query/spool/station=kkkk&select=glob_pattern
http://server:port/_get/inv/hhmm
The first can be used, for example, to request file transfers after a panfilter notification, and the second one to periodically request the list of certain files from a given station. The third command can be used to periodically request the latest minutely inventory file; the hhmm in that command should not contain the ".log" file extension, just the hour and the minute in hhmm format.

In the first command, the transfered file is the raw file that nbsp saves in the spool directory. If nbsp is configured to save the spool files with the CCB, then the transfered file will contain the (24 bytes) CCB.

An additional argument in the second command as ``&format=xml'' to return an xml formatted list.

For example, the following command queries the ``n0r'' radar files in the tjsj station:

http://diablo:8015/_query/spool?station=tjsj&select=*n0r*
The server would respond with a list such as
tjsj_sdus52-n0rjua.152206_164012674
tjsj_sdus52-n0rjua.152232_164041396
tjsj_sdus52-n0rjua.152011_163888260
Then executing
http://diablo:8015/_get/spool/tjsj_sdus52-n0rjua.152206_164012674
will retrieve that particular file.

The last command will return the inventory file for a particular minite, e.g.

http:///diablo:8015/_get/inv/1400
will return the list of files spooled at 14:00.