This is a simple product download client for the NWWS-2 OI (NOAA Weather Wire Service version 2 Open Interface) written in Python. The NOAA Weather Wire Service is a satellite data collection and dissemination system operated by the National Weather Service, which was established in October 2000. Its purpose is to provide state and federal government, commercial users, media and private citizens with timely delivery of meteorological, hydrological, climatological and geophysical information.
This client was developed and tested on Ubuntu 16.04 using Python v2.7 and makes use of the sleekxmpp Python library for connecting to the NWWS-2 OI XMPP-based server.
On Ubuntu, first install the sleekxmpp
library:
sudo apt-get install python-sleekxmpp
If not on Ubuntu, you can use pip to install:
pip install -r requirements.txt
Now, after cloning the latest release, create a JSON config file using the following format:
{
"username": "[username]",
"password": "[password]",
"resource": "[resource]",
"archivedir": "[archivedir]",
"pan_run": "[pan_run]"
}
The variables [username]
and [password]
are your NWWS-2 OI credentials obtained by signing up on the NOAA Weather Wire Service website. You may use whatever string you would like for [resource]
and the [archivedir]
variable is the directory on your system where you would like to store the downloaded products. The [pan_run]
variable is optional and specifies the path to a script or program that you'd like to run on product arrival. The client automatically passes the full path to the product to the supplied script or program.
Now run the client:
$ python nwws2.py /path/to/config/file
Provided that you're able to connect to the NWWS and your credentials are accepted, you will start to see products appear in the supplied archive directory in the following format:
[archivedir]/
[cccc]/
[cccc]_[ttaaii]-[awipsid].[ddHHMM]_[id].txt
The above variables have the following meaning:
cccc
- International four-letter location indicator of the station or centre originating or compiling the productttaaii
- tt - Report type, aa - Region of the report, ii - Report number. (more info)awipsid
- Product's AWIPS IDddHHMM
- Day, hour, and minute of product issuanceid
- Product NWWS ID
You can either run it via screen / tmux or use the included nwws2
script to run it using nohup. The client will automatically reconnect to NWWS if the connection is dropped.
The script will continue to run, downloading products to your system. Eventually, it will fill up your filesystem and you'll likely want to clear out old products. For example, to automatically remove products older than a week, insert the following line into your crontab:
0 0 * * * /usr/bin/find [archivedir] -type f -mtime +7 -delete >/dev/null
You will want to replace [archivedir] with the path to the product directory.
See LICENSE file.