Difference between revisions of "Plotting WRF Model output with GMT (Generic Mapping Tools)"

From assela Pathirana
Jump to navigationJump to search
m (Text replace - '<pre>' to ' <pre>')
 
(3 intermediate revisions by the same user not shown)
Line 16: Line 16:
# Edit the file <tt>./pltprogs/CONSTANTS.bash</tt> to reflect the paths in your computer. (Only <tt>GMT</tt>, <tt>convert</tt> and <tt>gifs</tt> entries need changing). Further change <tt>wrfntimes</tt> to indicate how many snapshots of output from the start of the model, needs processing. This should be less or equal to total number of output snapshots.  ( This is <tt>(Forecast length)/(output time step)</tt>)
# Edit the file <tt>./pltprogs/CONSTANTS.bash</tt> to reflect the paths in your computer. (Only <tt>GMT</tt>, <tt>convert</tt> and <tt>gifs</tt> entries need changing). Further change <tt>wrfntimes</tt> to indicate how many snapshots of output from the start of the model, needs processing. This should be less or equal to total number of output snapshots.  ( This is <tt>(Forecast length)/(output time step)</tt>)
# Go to the directory where <tt>wrfplot.bash</tt>. Copy or link the wrf output file to this place.  
# Go to the directory where <tt>wrfplot.bash</tt>. Copy or link the wrf output file to this place.  
# Execute the following command<pre><nowiki>./wrfplot.bash</nowiki></pre>
# Execute the following command
<pre><nowiki>./wrfplot.bash</nowiki></pre>


Upon successful execution the <tt>png</tt> format images and datasets used to plot them will be available in the folder <tt>./output</tt>.
Upon successful execution the <tt>png</tt> format images and datasets used to plot them will be available in the folder <tt>./output</tt>.


[[Category:Hydrology-Meteorology]][[Category:Computing]][[Category:Unix]]
 
==Data in a single file==
Some programs/utilities that use WRF model output (e.g. Hydrological/Hydraulic models, GIS) may need all data snapshots to be compiled in a single file. Following is a utility that can be used to convert the results of the above utility to a single snapshot. Simply unzip the program in the directory where <tt>wrfplot.bash</tt> is and run it.
;The program: [[image:wrfplot_foldup.zip]]
;Running it:
<nowiki>
</nowiki>
<pre><nowiki>
unzip wrfplot_foldup.zip
chmod u+x foldup.bash
./foldup.bash
</nowiki></pre>
==Extracting a single column of data==
Use the following script
<nowiki>
</nowiki>
<pre><nowiki>
#!/bin/bash
if [ $# -lt 1 ]; then
        echo "Usage: $0 <datafile> <column number>"
        echo " NOTE: column number ignoring date columns"
        exit 5
fi
col=$(( $2 + 6 ))
cat $1|awk -v col=$col '{print $1, $2, $3, $4, $5, $6, $col}' > $1.$2.txt
</nowiki></pre>
 
 
[[Category:Hydrology-Meteorology]][[Category:Computing]][[Category:Unix]][[Category:WRF Model]]

Latest revision as of 19:12, 2 October 2009

In the real-time weather forecast page for Sri Lanka, I plot WRF model output using GMT (Generic Mapping Tools) rather than standard plotters provided by the model developers. Following is the method to do it.

Dependencies

Need the following programs installed
  1. NetCDF [1]]
  2. GMT version >= 4.0 [2]
  3. gifsicle program for making GIF animations. [3]
  4. Portland group FORTRAN compiler (for Linux) or any other suitable FORTRAN compiler.

Download

Version 2: With a few improvements. File:WrfGMTplot.tar.gz

Usage

  1. Compile the FORTRAN program ./pltprogs/read_wrf_nc.f to produce the executable read_wrf_nc
  2. Edit the file ./pltprogs/CONSTANTS.bash to reflect the paths in your computer. (Only GMT, convert and gifs entries need changing). Further change wrfntimes to indicate how many snapshots of output from the start of the model, needs processing. This should be less or equal to total number of output snapshots. ( This is (Forecast length)/(output time step))
  3. Go to the directory where wrfplot.bash. Copy or link the wrf output file to this place.
  4. Execute the following command
./wrfplot.bash

Upon successful execution the png format images and datasets used to plot them will be available in the folder ./output.


Data in a single file

Some programs/utilities that use WRF model output (e.g. Hydrological/Hydraulic models, GIS) may need all data snapshots to be compiled in a single file. Following is a utility that can be used to convert the results of the above utility to a single snapshot. Simply unzip the program in the directory where wrfplot.bash is and run it.

The program
File:Wrfplot foldup.zip
Running it

unzip wrfplot_foldup.zip
chmod u+x foldup.bash
./foldup.bash

Extracting a single column of data

Use the following script

#!/bin/bash
if [ $# -lt 1 ]; then 
        echo "Usage: $0 <datafile> <column number>"
        echo " NOTE: column number ignoring date columns"
        exit 5
fi
col=$(( $2 + 6 ))
cat $1|awk -v col=$col '{print $1, $2, $3, $4, $5, $6, $col}' > $1.$2.txt