source: trunk/UTIL/PYTHON/Intercomparison/1D_sensibility_tool/probe.sh @ 764

Last change on this file since 764 was 764, checked in by acolaitis, 12 years ago

###################################################
# PYTHON / PLANETPLOT #
###################################################

# ------------------- XY plots ------------------ #

# Added a new category of plot to unidim, contour, etc... called "xy"
# - xy plots are plots that do not use time,vert,lat or lon as axis
# - variables to be plotted are stored in plot_x and plot_y, which is done in
# select_getfield. (there is no "what_I_plot" var for "wy" plots)
# - plot_x and plot_y are also subject to reduce field. A None value indicates
# the plot is not 'xy'
# - "xy" plots are used for a specific subset of plots : histograms, fourier
# transforms, hodographs
# - added option --analysis to perform certain kinds of analysis on the data
# (corresponding to xy plots).
# - One selects the fields he wants to plot (e.g. -v UV --lon 0 --lat 20) and
# chooses a kind of analysis :

--analysis fft # in the particular case given above, this mode corresponds

# to the mean of the ampitude spectrum of the vertical spatial
# fast fourier transform taken at each time index
# note that for now, fft are always done along the vertical
# axis. This could be made more flexible.
# not that the minimum wavelength you can plot depends on the
# vertical step of your simulation. THIS STEP HAS TO BE
# CONSTANT, hence you MUST use API or ZRECAST with constant
# spacing.

--analysis histo # histogram on the flattened data. If the user asks for --lon 0,20,

# the average is done before computing the histogram (contrary to the fft).
# However, if given a 2D array (with only --lon and --lat on a
# 4D field for example), the data is flattened before computation
# so that the result is still a 1D histogram.

--analysis histodensity # histogram with a kernel density estimate to a

# gaussian distribution, also giving the mean, variance,
# skewness and kurtosis. Other distributions are available in
# the scipy.stats package and could be implemented.

# - added variables "-v hodograph" and "-v hodograph_2". First one is a
# regular hodograph with "u" and "v" as axis, with labels of the local times
# (use --axtime lt). This is a "xy" plot (you must specify a vertical level
# as well, usually --vert 0 with an interpolation at 5m (-i 4 -l 0.005)).
# Second one is the variation with local time (for exemple) of the wind
# rotation (arctan(v/u)). This is not a "xy" plot but "unidim".
# For --ope plots in "xy" cases, only the operation plot is displayed.

# ------------------- Operations ------------------ #

# - For operations --ope -, the histogram (fourth plot) has been removed. To get it
# back, call --ope -_histo.
# - _only has been added to "+","-","-%" operations (eg "-_only")
# - For operations "-","+","-%","-_only","+_only","-%_only","-_histo", it is now
# possible to call multiple files (sill one variable) and compare each of them
# with the unique given reference file. Ex: -f file1,file2 --fref file3 --ope - will give 6 plots:

file1 file3 file1-file3
file2 file3 file2-file3

# In the case of "xy" plots, the multiple operation plots are regrouped on a
# single plot (using multiple lines). the title of this plot is not 'fig(2)-fig(1)'
# (default) but the argument of the --title command. Labels have to be given
# as following : --labels "dummy","dummy","file1-file3 label","dummy","dummy","file2-file3 label" (dummy can be anything. this is to be improved)
# To be able to run on multiple files and easily introduce the correct number and order of plots, these operations have been moved outside of the main loop
# on namefiles and variables. Operation of the type "add_var" or "cat" have
# been left inside the loop and are unchanged.

# ------------------- Localtime ------------------ #

# Changed the way localtime is computed. Reasons:
# - it was assuming one timestep per hour in computations mixing indices and
# actual times
# - to determine the starting date, it was using the name of the file (for Meso), instead of using the netcdf
# attribute (START_DATE)
# - it was using the computed mean longitude of the domain, which is not correct for
# hemispheric domain. => better to use the netcdf attribute CEN_LON
# - it was using this mean longitude even for profile plots at given
# longitude => better to get the local time at this given lon, especially
# important for large domains
# => new localtime() is in myplot (old one is commented). Interv is obsolete (but not removed yet). Case "Geo" has not been looked at.
# new localtime in myplot correctly account for starting date of the file in
# all cases
# accounts for local longitude of the plot
# accounts for files that do not have per hour outputs, but per timestep.
# specific cases can be added in myplot in localtime()

# ------------------ Misc ------------------ #

# - added option --xlog to get x logarithmic axis (--ylog already existed)
# - added the possibility to use 2 files of different gridding (-f
# file1,file2) although of the same type (meso for exemple). For that purpose,
# lon, lat, alt and vert arrays are now indexed with 'index_f', as for
# all_var. => all_lon, all_lat, all_lat, all_vert
# - added function teta_to_tk in myplot so that a call to pp.py on standard
# LMD mesoscale file with "-v tk" can be done without the need to call API.
# The temperature is computed from T and PTOT, knowing P0, T0 and R_CP.
# - bug correction in determineplot() that was causing wrong plot number and
# slices number when not calling averaged lon, lat, vert or times. (which is
# often !)
# - added new options to redope: --redope edge_x1, edge_x2, edge_y1, edge_y2
# which plots the boundaries of the domain. This is different compared to
# asking for a fixed longitude, because the domain boundary might not be at constant
# longitude (hemispheric domain for exemple). x1 is the western boundary, x2
# the eastern, y1 the southern and y2 the northern. x1 and x2 reduce the
# dimension along --lon, y1 and y2 reduce the dimension along --lat.
# - added control in windamplitude() to determine whether winds are staggered or
# unstaggered. This is usefull when dealing with non LMD_MMM files.
# - corrected a bug in reduce_field where the mean was computed on the wrong
# axis !!! (pretty serious bug)

# Exemple of plots you can do with these new options can be found in
$YOUR_SVN/trunk/UTIL/PYTHON/Intercomparison/Plots_MasterScript/bam.sh

# ------------------ API ------------------ #

# - changed maximum of levels from 299 to 1000 in API (interpolation on 1000 levels is
# usefull to get larger bandwidth in fourier transform)
# the following concerns users of MRAMS files.
# - API has not been modified for MRAMS files. Instead, a python script
# (ic.py) is run on MRAMS .ctl and .dat files, which automatically format those files
# to be API and pp.py compatible.
# - ic.py is in $YOUR_SVN/trunk/UTIL/PYTHON/Intercomparison/File_conversion

###################################################
# INTERCOMPARISON TOOLS: #
###################################################

#ic.py in
$YOUR_SVN/trunk/UTIL/PYTHON/Intercomparison/File_conversion
#CDO installer with import_binary in
$YOUR_SVN/trunk/UTIL/PYTHON/Intercomparison/CDO
#Plotting scripts in
$YOUR_SVN/trunk/UTIL/PYTHON/Intercomparison/Plots_MasterScript
#1D sensibility tool in
$YOUR_SVN/trunk/UTIL/PYTHON/Intercomparison/1D_sensibility_tool

# See README in each of these folders for details.

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1#!/bin/bash
2taus="0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0"
3TAU=($taus)
4
5if [ $1 == run ]
6then
7
8for i in 0 1 2 3 4 5 6 7 8 9
9do
10rm -rf r$i
11mkdir r$i
12ln -sf ../run.def r$i/.
13ln -sf ../z2sig.def r$i/.
14ln -sf ../traceur.def r$i/.
15ln -sf ../testphys1d.e r$i/.
16ln -sf ../profile r$i/profile
17cp callphys.def r$i/.
18sed -e s/'tauvis=999'/'tauvis='${TAU[ $i ]}/g r$i/callphys.def > r$i/callphys.def.tmp ; \mv r$i/callphys.def.tmp r$i/callphys.def
19done
20
21for i in 0 1 2 3 4 5 6 7 8 9
22do
23cd r$i/.
24echo 'running case '$i
25./testphys1d.e > a.out
26cd ..
27done
28
29fi
30
31if [ $1 == analyse -o $1 == run ]
32then
33  if [ $2 == eps ]
34  then
35    format='eps'
36  else
37    format='png'
38  fi
39pp.py -f r0/diagfi.nc,r1/diagfi.nc,r2/diagfi.nc,r3/diagfi.nc,r4/diagfi.nc,r5/diagfi.nc,r6/diagfi.nc,r7/diagfi.nc,r8/diagfi.nc,r9/diagfi.nc -v fluxsurf_lw --labels "tau=0.1","tau=0.2","tau=0.3","tau=0.4","tau=0.5","tau=0.6","tau=0.7","tau=0.8","tau=0.9","tau=1.0" --lstyle '-k','--k','-r','--r','-y','--y','-g','--g','-b','--b' -S $format -d -O fluxsurf_lw_taus --title "Incident LW flux at surface"
40pp.py -f r0/diagfi.nc,r1/diagfi.nc,r2/diagfi.nc,r3/diagfi.nc,r4/diagfi.nc,r5/diagfi.nc,r6/diagfi.nc,r7/diagfi.nc,r8/diagfi.nc,r9/diagfi.nc -v fluxsurf_sw --labels "tau=0.1","tau=0.2","tau=0.3","tau=0.4","tau=0.5","tau=0.6","tau=0.7","tau=0.8","tau=0.9","tau=1.0" --lstyle '-k','--k','-r','--r','-y','--y','-g','--g','-b','--b' -S $format -d -O fluxsurf_sw_taus --title "Incident SW flux at surface"
41pp.py -f r0/diagfi.nc,r1/diagfi.nc,r2/diagfi.nc,r3/diagfi.nc,r4/diagfi.nc,r5/diagfi.nc,r6/diagfi.nc,r7/diagfi.nc,r8/diagfi.nc,r9/diagfi.nc -v tsurf --labels "tau=0.1","tau=0.2","tau=0.3","tau=0.4","tau=0.5","tau=0.6","tau=0.7","tau=0.8","tau=0.9","tau=1.0" --lstyle '-k','--k','-r','--r','-y','--y','-g','--g','-b','--b' -S $format -d -O tsurf_taus --title "Surface temperature"
42pp.py -f r0/diagfi.nc,r1/diagfi.nc,r2/diagfi.nc,r3/diagfi.nc,r4/diagfi.nc,r5/diagfi.nc,r6/diagfi.nc,r7/diagfi.nc,r8/diagfi.nc,r9/diagfi.nc -v "rh-1" --labels "tau=0.1","tau=0.2","tau=0.3","tau=0.4","tau=0.5","tau=0.6","tau=0.7","tau=0.8","tau=0.9","tau=1.0" --lstyle '-k','--k','-r','--r','-y','--y','-g','--g','-b','--b' -S $format -d -O invrh_taus --title "Heat aerodyn conductance"
43
44if [ $format == 'png' ]
45then
46  montage fluxsurf_lw_taus_200.png fluxsurf_sw_taus_200.png tsurf_taus_200.png invrh_taus_200.png -mode concatenate -tile 2x2 tau_sensitivity.png
47  \mv fluxsurf_lw_taus_200.png fluxsurf_sw_taus_200.png tsurf_taus_200.png invrh_taus_200.png figures/.
48  \rm fluxsurf_lw_taus.sh fluxsurf_sw_taus.sh tsurf_taus.sh invrh_taus.sh
49  cp tau_sensitivity.png figures/.
50fi
51\rm fluxsurf_lw_taus.sh fluxsurf_sw_taus.sh tsurf_taus.sh invrh_taus.sh
52fi
53
54if [ $1 == clean ]
55then
56
57rm -rf figures
58mkdir figures
59rm -f *.png
60
61fi
Note: See TracBrowser for help on using the repository browser.