From WxWiki
Revision as of 19:55, 7 September 2020 by Peterj (talk | contribs) (Peterj moved page TeachWx-2:Main to TEACHWX:Main)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Teaching Weather and Climate UNDER CONSTRUCTION

This wiki is for instructors teaching meteorology. It is meant to be a venue to share relevant resources, teaching tips, teaching materials, best practices, etc. To participate, please sign up -- go to Special:RequestAccount and sign up!


Meteorology Today: An Introduction to Weather, Climate and the Environment, 2012, 1st Canadian Edition, by C. Donald Ahrens, Peter L. Jackson, Christine E.J. Jackson

This interactive site offers a number of password-protected resources that will enhance your teaching. For your convenience, we have also displayed the resources your students can use to test themselves, research, or review.

Online Weather Resources and Technology

Public Weather Display

At the University of Northern British Columbia, we have a public weather display which is comprised of a computer with two monitors that are in a display case in the corridor of our teaching laboratory building. Various web browser windows are open which show animations of radar and satellite imagery, as well as animated surface analysis and NWP prognoses. In addition, the data from our campus weather station are displayed and updated in real time.

Most of the loops come from the UNBC WeatherViewer (WxV) - a package developed by Ford Doherty, meteorologist at the Pacific Storm Prediction Centre of Environment Canada. The WxV software is mainly used internally at MSC, and I think the UNBC implementation is the only one available outside the EC firewall. You can see the kinds of loops available at weather.unbc.ca/wxv. Most of the loops displayed on the UNBC campus weather display are listed here.

The UNBC campus weather station is on a 10 m mast(wind, temperature, net radiation) and a 3 m tripod (incoming shortwave and longwave radiation, temperature and RH) on the roof of our research lab building. The instruments are connected to a Campbell Scientific 21X data logger, which stores 10 minute averages. The data logger is poled by a computer running CSC loggernet software to download the data every 10 minutes. Scripts running under cron on a linux server manipulate and plot the data using gnuplot, to produce the 5-day time series of current weather. We also use the CSC RTDM software to produce a realtime display of the current weather conditions, although the gnuplot 5 day time series is more useful.

I find that I use the real time data in almost every lecture in my second year introductory course. Weather "comes alive" when you can relate the concepts learned in class to what is actually happening outside.

Environment Canada real-time public weather forecasts

One of the features we have recently added to the public weather display, is a web page showing the current Meteorological Service of Environment Canada public weather forecast for the region that is continuously updated as new forecasts come in. Environment Canada of course has forecast information available on their excellent weatheroffice web site, however this page is not directly suitable for a public weather display since it does not update automatically, and also contains too much information.

MSC does make available a flash application called weatherlink which alternates between displaying the current conditions and the forecast for a given city. It is a great way of adding MSC information to a web page, however it doesn't seem to update automatically either, and it doesn't display the full seven day forecast.

MSC makes all sorts of data available on their datamart website for download, including the public forecast data in xml format organized by province and city at this location. In order to convert the xml data into a web page to display and format selected parts of the data, an xsl template needs to be written. I have written two templates, one to display the data in a horizontal format, and the other to display it in a vertical format. The xsl file in combination with the xml file from MSC for a given city, is used to create an html web page that updates automatically.

Since I already have a cron job that runs on a linux server to download and plot the campus realtime weather data, I simply added a script that accomplishes this for the public weather forecast. Here is what the script has in it:

cd /home/wx/FCST; \
wget -O ./yxs.xml "http://dd.meteo.gc.ca/citypage_weather/xml/BC/s0000146_e.xml" -o log; \
xmlto --skip-validation -x MSC-fcst.xsl html yxs.xml; \
mv yxs.proc yxs.html;\
xmlto --skip-validation -x MSC-fcst-vert.xsl html yxs.xml; \
mv yxs.proc yxs-vert.html

This uses "wget" to download the xml file from datamart for Prince George. It then runs the program "xmlto" that uses the xsl style files to convert the xml into two html web pages -- horizontal and vertical.

Uploading data collected from campus weather station to weatherunderground PWS network

At UNBC we have a Campbell Scientific-based campus weather station. The weatherunderground has a network of over 25,000 personal weather stations (PWS) that are available with a google map interface. Data from PWS's is uploaded, usually by software that accompanies the personal weather stations. Here is how we upload the data from our weather station.

First it is necessary to output the data in the format the weatherunderground needs. Our weatherstation is polled from a windows PC using the Campbell Scientific "loggernet" program. Loggernet has many options, one is that it can be configured to run a script or program after data is collected (in our case every 10 minutes). A component of loggernet is a program called "SPLIT" which can be run in a windows interface within loggernet and can be run from a command prompt with arguments. SPLIT is the report generating / data extraction and formatting component of loggernet. I combine SPLIT run on the windows PC which extracts the data, with a shell script that I run from a cron job on my linux server that provides the timestamp information and uploads the data to the weatherunderground server using a program called "curl".

So, here are the steps I have used to do this, which are a modified version of the method mentioned on this Campbell Scientific user forum posting.

  • Create a split .PAR (parameter file) that will extract the variables needed to be uploaded. This is done with SPLIT run as a gui from within loggernet.
    • On the "Input File" tab of split, select the .DAT file (i.e. the data file from the weather station) that you want split to extract data from.
    • Using the "Offsets / Options" dialog, select "Last count" under the Start Offset section, to have split only process the most recent data (otherwise it will process the whole data file each time).
    • To list what data you have in your .DAT file, select "Labels | Use Data Labels", from the pop-up select the .fsl file that is associated with your datalogger that links labels with the data fields.
    • Choose the output array that you want to use. I use one that is called "10" for the 10 minute data.
    • Move to the "Select" box, which is where you will select the data that are output, including text information that weatherunderground wants.
    • Using the Data File Labels pop-up it is possible to select and "Paste" the data that you want into the "Select" box. In the "Select" box you can convert the data to the units that weatherunderground wants, and also put in text that it wants too.
    • You will need to go to the "Output File" tab, and make sure that you have a large enough column width to display the text and data, and also that you have the correct number of decimal places displayed for your data. Also select the file name you want output written to in this tab.
    • The format that weatherunderground wants is listed here. I just use SPLIT to output the meteorological data that I need. My "Select" field looks like this:
      • "&winddir=",6,"&windspeedmph=",5*2.236936, "&humidity=",12, "&tempf=",11*1.8+32.0, "&baromin=" ,14*0.029529884, "&solarradiation=",8, "&action=updateraw" The first number after each label is the field from the .DAT file that contains that data and is selected using "Paste".
    • Try running this SPLIT .PAR file to see if it produces the data you think it should
    • Save the .PAR file. I save mine to Z:\wunderground\wunder-extract.PAR .
  • Next it is necessary to have loggernet run SPLIT using the .PAR file that was created, after each data download. To do this:
    • Run the loggernet "Task Master" program, and select an "Add After" task that executes after data gets downloaded.
    • Select the "Execute File" option and navigate to the "SPLITR.EXE" program, usually in C:\Program Files\Campbellsci\LogerNet\SPLITR.EXE
    • For the Command Line Options, enter the path to the .PAR file you created, with a /r at the end, e.g. Z:\wunderground\winder-extract.PAR/r
    • On the "Status" tab, make sure that the tasks will run, and are not paused; check to make sure the task gets run regularly and that the output file is actually created. Here is what one of my output files looks like:
      • &winddir= 201.0&windspeedmph= 11.0&humidity= 69.3&tempf= 39.6&baromin= 30.1&solarradiation= 82.4&action=updateraw
  • The last part of the processing is done on the linux server side. The directory where LoggerNet / SPLIT on the windows machine write the output is a directory mounted from my linux server. The linux server creates a timestamp and some text that precedes the data produced by SPLIT, combines this with the data produced by SPLIT using the "paste" command, and then uses "curl" to upload the completed data string to weatherunderground. This script is run every 10 minutes using the linux 'cron' facility:

echo 'ID=IBRITISH158&PASSWORD=PASSWD&dateutc='`TZ=GMT date +"%Y-%m-%d+%H:%M:00"` > header.txt
paste header.txt WUPLOADDATA.PRN > upload.txt
curl --trace-ascii curl.log --get --data @upload.txt http://weatherstation.wunderground.com/weatherstation/updateweatherstation.php

where PASSWD is the weatherunderground password, the ID string at the start is the ID of our weather station on weatherunderground and the file WUPLOADDATA.PRN is the name of the datafile produced by SPLIT



Lecture exercises

Lab exercises

Problem sets

TeachWX:Private (members only)