# Streamer project

## 1. Overview

This project gives you experience with using an existing radiative transfer model that performs a simplified (parameterized) computation of broadband (shortwave and longwave) fluxes as functions of surface properties and  atmospheric profiles of temperature, humidity, ozone, carbon dioxide, and other constituents. You will install and run the model for “baseline” cases and then evaluate how your results change when atmospheric properties are modified. (NOTE FOR FUTURE YEARS:  Consider instead using the BUGSrad model instead of Streamer.)

## 2. Obtaining Streamer

1. Use it on the lab computers in 1411.  This option might be preferable if you don’t have convenient access to another Linux or Mac OS X machine.
2. Install it on a machine that you control or have an account on.  For some machines, you might need to compile it from scratch, in which case you will have to have a working Fortran compiler.  For others, you may be able to download precompiled binaries.
Details of these two options are given below.

### 2.1 Using Streamer on the machines in 1411

You can use Streamer on the Linux computers in 1411, where it is (or should soon be) already installed.   You don’t need to be physically present in the room to use these computers;  you can also use the ‘ssh’ command to remotely login to one of the lab computers from another Linux, Unix, or Mac machine; e.g.,
ssh cat5.aos.wisc.edu
where ‘cat5’ should be replaced with the actual machine name you want to use (see labels on the monitors).  You will be prompted for your AOS user-ID and password. If you have the ability to run X-Windows on your local machine (this is default for most Linux machines and fairly easily enabled for Mac OS X), then you can instead login via
ssh -X cat5.aos.wisc.edu
which will allow editors and other GUI-based applications to run in their own window rather than in a text terminal.  This is especially useful if you want to display plots on your screen over the remote connection. Once you are logged into the Linux machine, you should be able to execute Linux/Unix commands at the command line, open an editor (e.g., Emacs), create or edit your input files (e.g., shortwave.inp), and execute Streamer via
streamer shortwave.inp
If something doesn’t work, please ask me or Pete Pokrandt to help figure out why — usually the fix will be simple but non-obvious to the novice Linux user.

## 3. Testing Streamer

Streamer is a command-line program, which means that you have to open a terminal window that provides a Linux, Unix, or Mac OS X command prompt.  (Note: While I know that an MS-Windows version of Streamer exists, I don’t know the procedure for executing it.) Once you have streamer installed, test it as follows:
• In that same directory, execute the command
streamer all_bands.inp
This will generate an output file all_bands.out.
• If available, use the Unix command “diff” to compare your output file and the test file provided above and verify that any differences, if present, are not significant (e.g., slight differences in rounding of floating point numbers):
diff all_bands.out all_bands_test.out | more
If streamer is ‘not found’ despite having been physically installed on your machine, you may have to fix your PATH variable, which tells the operating system where to look for executable programs. If streamer executes but generates errors or creates an output file that is significantly different than the comparison file provided, please let me know.

## 4. Using Streamer

The top-level procedure for performing radiative transfer calculations with Streamer is straightforward:
1. Using a text editor like vi, pico, or Emacs, create or edit an input file (e.g., shortwave.inp) that describes all the parameters of the problem, such as atmosphere profile and surface properties, wavelength bands of interest, etc.
2. Execute the streamer command with the input file as the sole argument; e.g., ‘streamer shortwave.inp’).  It should execute in seconds and create an output file whose name is specified in the input file.
3. Extract the desired numerical results from the fairly verbose output file and import it into another suitable program (e.g., python) for post-analysis and plotting.
4. Repeat for different cases, bands, etc.
You will find that step 3 will require the most labor.  Generally speaking, you can either use a tedious brute-force method (e.g., manual cut-and-paste) to extract the columns of numbers you wish to plot, or you can write your Python program to help automate the process (see Section 6).  The initial effort will be greater, but it may save you considerable time in the long run, especially when running calculations for each of 129 different bands!

## 5. Setting up the input file

The input files for Streamer are usually small, and they’re created and edited in a text editor.  Even a very simple editor like Notepad or TextEdit will work for these files. Complete instructions for using Streamer are in the User Guide (pdf).  You should download this guide and refer to it when interpreting the options and data inputs required in the input file, especially the information beginning p. 16. Here are sample input files that you can use as your starting point for various experiments:
• shortwave.inp – Broadband fluxes and heating rates for shortwave only.
• longwave.inp – Broadband fluxes and heating rates, longwave only.
• combined.inp – Broadband fluxes and heating rates, both shortwave and longwave.
• all_bands.inp – Band-by-band fluxes and heating rates; each of 129 bands in sequence (suitable for plotting spectra).
• single_band.inp – Single band fluxes and heating rates.
There are only a few parameters in the input file that you may want to change for this project, in particular
• icthck (p. 19) – Determines the manner in which cloud thickness is specified.  Set to ‘3’ for this project.
• STDPROF (p. 18) – The standard atmospheric profile to use (1-7)
• USERFILE (p. 20) – The name of your output file  (e.g., ‘all_bands.out’)
• rectitle (p. 21) – Description of current run (not really needed for anything, so you can leave this unmodified if you like
• year month day hour lat lon zen (p. 21) – Time and location data.
• nclouds ntype(1)etc. (p. 25-26) – Various parameters related to the specification of the cloud layer properties (if used). In particular,
• First value (nclouds) is 1 to add the cloud layer to the Streamer calculation, 0 to turn off the cloud
• cldtop gives the height of the cloud base in km
• cldthick gives the physical thickness in km (ignored if ‘icthck=3′ is used)
• cldtau gives the cloud optical thickness.  Should be set to 10.0.
• cldphase1 gives the type of cloud particle (e.g., 0=liquid; 8=spherical ice)
• cldwc gives water concentration.  Should be set to 0.07 for our experiments.
• altchoice etc. (p. 28) – You will leave the first six integers set to ‘2’.   n_in should be 0.  Then use frwv, fro3, etc., to specify scalings of the constituent profiles.  For example, setting frwv to 0.9 means that the water vapor profile will be scaled to 90% of the standard profile for the particular atmospheric model used.   Setting frco2 to 2. implies a doubling of CO2.  For this project, you will normally leave all at 1. EXCEPT for any particular constituent you are modifying for a particular experiment.
• bstart bend (p. 22) – Range of bands to use for one case. Can be set to either do a whole range of bands together or to do them in sequence (see example input files)
The locations of the above are highlighted in yellow in the following screenshot (click to enlarge):

## 6. Output

The output from Streamer is relatively straightforward to view and interpret.   It is somewhat less straightforward to import into a program for post-analysis and plotting, in part because of all the informational text embedded in the output file. Here is a  Python program that illustrates one way of breaking apart the cases in a multi-case run and extracting the flux data for plotting.  This particular version is designed to work with the output from the all_bands.inp input file, but it can be readily adapted to other cases as well. You may choose to use one program to extract the desired data to a file and then a second program to read the extracted data from the same file for plotting and analysis.  Usually it’s more efficient to combine everything into single program.  If appropriate, you should save different versions of python programs under unique names so that you can easily repeat a plot or calculation, if necessary. See this page for various Python references and examples.

## 7. Experiments

1. Compute radiative fluxes and heating rate profiles for two “baseline” cases.  The baseline cases are
• Standard tropical atmosphere (model 1), no cloud, standard constituent profiles, solar zenith angle of 71 degrees.
• Standard winter arctic atmosphere (model 7) , no cloud, standard constituent profiles, solar zenith angle of 84 degrees.
Note that the zenith angles are chosen here so that the solar flux at the top of the atmosphere is of comparable magnitude to the outgoing longwave flux.

2. Plot or tabulate  the key results for the above two baseline cases, and describe/explain the most significant differences between them.  For the purposes of this project, key results include
• (SW, LW, and combined) x (upward, downward, and net [positive upward]) x (top-of-atmosphere and surface) = 18 distinct numbers tabulated appropriately for each model atmosphere. See Note A, below.
• Spectral fluxes plotted for (upward, downward, and net) x (top-of-atmosphere and surface) = 2 plots with 3 curves on each plot for each model atmosphere.   See Note B, below.
• Heating profiles plotted for (SW, LW, and combined) for each model atmosphere. See Note C, below.
• Spectral heating profiles similar to this: heating.pdf (see Note D, below).
3. Radiative forcing is defined as the change in radiative flux that results from making a particular change to the atmosphere.  For both the tropical atmosphere and the polar atmosphere, repeat the above calculations, but with the following changes each made in turn:
• 10% increase in water vapor amount everywhere in the column. This means simultaneously increasing both the WV and the WV continuum parameters.
• Double CO2 concentration.
• 50% reduction in ozone concentration.
• Add liquid water cloud layer (cloudphase1 = 0 ) with optical thickness 10.0 and base at 1.0 km.
• Same as above, but moving the cloud layer to 10.0 km and changing the cloud particle type to “spherical ice”  (cloudphase1 = 8 )
For each of the above changes, plot or tabulate the associated changes (relative to the baseline case) in the fluxes and heating profiles. NOTE: For cloud experiments you will need to make the following changes to your input file:
• Change icthk (second to last value in the 13th input line) to 3, so that cloud thickness is specified in optical units.
• Change cldwcl (last element in the cloud properties line) to 0.07 to ensure that cloud water density remains within the allowable range for both the low and high cloud layer.

## 8. Writeup

Each standard case or experiment  will yield a set of plots and tables, all of which can probably fit on one page with careful arrangement and scaling.  For ease of importing and to ensure publication quality, use PDF as the file format for your plots.
Where practical, try combining both the tropical and polar cases in the same plots for ease of comparison and to use space more efficiently. Choose the font sizes for labels so as to be easily readable when the plot is scaled to single-column width in your writeup, or double-column width if you create a single larger figure with sub-figures labeled (a), (b), etc.
Starting with the AMS LaTeX template, begin your writeup by importing the above figures and creating the required tables.   Don’t worry about the precise placement of tables or figures at this point; these will change as you add text to your writeup.  Instead, just worry for now about the scaling and order of the figures as well as captions.

PLEASE USE THE DOUBLE COLUMN PREPRINT FORMAT FOR THE FINAL VERSION YOU HAND IN.

Your writeup should include the following sections:
• Abstract – A brief summary of the work described in your writeup along with key findings.  This is often written last.
• Introduction – A very brief overview of the scientific relevance of the work that will be described and an overview of your investigation.
• Methods – A very brief outline how you will use Streamer to determine the quantities of interest and what set of experiments you will run.  You can imagine that a reader of your paper won’t have seen these instructions and wants to know in very basic terms what your computations will show.
• Results – This is where you will put your tables and figures.  You should use subsections to organize your results, and in each subsection, you should provide a written description of the key features or behavior you observer.
• Conclusions – Summarize what you think are the most important findings in your results section, and provide some context if you can.  In addition, you might describe any additional experiments that you think would be interesting.
• References – Any relevant references should appear here (e.g., for Streamer, etc.).
Discuss (interpret and explain) the major features seen in your results for the standard cases, relating them to the absorption properties of gaseous constituents wherever possible. Discuss the major changes seen in your results for the experiments. What I am primarily looking for in your writeup for grading purposes is evidence that
• you succeeded in running Streamer and parsing the output files,
• you performed the indicated experiments,
• you were able to summarize your results effectively with readable, easily interpreted plots and tables
• you have gained enough insight into radiative transfer to be able to offer CONCISE and reasonably CORRECT interpretations of the results.

### Notes

#### A. How to organize your tables:

Where applicable for fluxes (or flux differences), please use the following format for tables
 Tropical SWup SWdn SWnet TOA SFC
Repeat for LW and combined LW+SW results and for different baseline models and/or experiments.

#### B. How to plot spectral fluxes

• You have to divide the flux (W/m^2) in each band by the spectral WIDTH of the band to get units of spectral flux (W/(m^2 micron)).
• The x-axis is wavelength in micrometers and should be logarithmic.  Please set the upper limit to 100 microns, as nothing interesting happens beyond that point anway.
• Don’t just plot the spectral flux as computed in the first step, because LW values will look way smaller than SW values, owing to the “per unit wavelength” part of the definition — the SW band spans only a few microns while the LW band spans about 50 microns or so. Rather, multiply the spectral flux in (1) by the wavelength at the center of each band. This will give a spectral flux in (W m^2 per unit log(wavelength)) which is then graphically compatible with your log axis for wavelength. That is, both the areas under the curves and the heights of the curves are now comparable between the SW and LW bands.

#### C. Plotting profiles

• Please choose your horizontal axis limits to be consistent between all of your plots of a particular type so that magnitudes can be easily compared between plots.
• Please set your vertical axis limits to run from the surface to 50 km.  We will not be concerning with results above that altitude.
• Because heating rates are computed from the difference in the net flux between pairs of levels, the heating rate at the surface is not meaningful for our purposes.  So please plot only levels 1-24 from the output files.

#### D. Plotting spectral heating profiles

• Start with this program (rename to get rid of the .txt suffix and change to a .py suffix after you download it), which will make the plot for a given case.
• For the forcings associated with your experiments, you should start by saving the baseline heating rate array to a file (you will only need to do this once).  Then modify the above program to load that file first and then subtract it from the new heating rates before plotting.