Skip to content

Commit

Permalink
Merge pull request #38 from pdziekan/qv_qc_2_6_10
Browse files Browse the repository at this point in the history
Qv qc 2 6 10
  • Loading branch information
pdziekan authored Sep 6, 2017
2 parents 4cbffdb + 803e441 commit 232ae86
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 3 deletions.
7 changes: 6 additions & 1 deletion drawbicyc/drawbicyc.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include"plot_series.hpp"
#include"plot_prof.hpp"
#include"plot_fields.hpp"
#include"plot_qv_qc_2_6_10_min.hpp"

int main(int argc, char** argv)
{
Expand All @@ -13,6 +14,7 @@ int main(int argc, char** argv)
("profs", po::value<bool>()->default_value(true), "plot profiles?")
("series", po::value<bool>()->default_value(true) , "plot series?")
("fields", po::value<bool>()->default_value(false) , "plot fields?")
("qv_qc_2_6_10_min", po::value<bool>()->default_value(false) , "plot comparison of qv and qc fields at 2, 6 and 10 min?")
("dir", po::value<std::string>()->required() , "directory containing out_lgrngn")
("micro", po::value<std::string>()->required(), "one of: blk_1m, blk_2m, lgrngn")
("type", po::value<std::string>()->required(), "one of: dycoms, moist_thermal")
Expand Down Expand Up @@ -40,7 +42,8 @@ int main(int argc, char** argv)
// reading required plot types
bool flag_series = vm["series"].as<bool>(),
flag_profiles = vm["profs"].as<bool>(),
flag_fields = vm["fields"].as<bool>();
flag_fields = vm["fields"].as<bool>(),
flag_qv_qc_2_6_10_min = vm["qv_qc_2_6_10_min"].as<bool>();

// detecting input data dimensionality
H5::H5File h5f(h5 + "/const.h5", H5F_ACC_RDONLY);
Expand All @@ -53,12 +56,14 @@ int main(int argc, char** argv)
if(flag_series) plot_series(PlotterMicro_t<2>(h5, micro), Plots(type));
if(flag_profiles) plot_profiles(PlotterMicro_t<2>(h5, micro), Plots(type));
if(flag_fields) plot_fields(PlotterMicro_t<2>(h5, micro), Plots(type));
if(flag_qv_qc_2_6_10_min) plot_qv_qc_2_6_10_min(PlotterMicro_t<2>(h5, micro), Plots(type));
}
else if(NDims == 3)
{
if(flag_series) plot_series(PlotterMicro_t<3>(h5, micro), Plots(type));
if(flag_profiles) plot_profiles(PlotterMicro_t<3>(h5, micro), Plots(type));
if(flag_fields) plot_fields(PlotterMicro_t<3>(h5, micro), Plots(type));
if(flag_qv_qc_2_6_10_min) plot_qv_qc_2_6_10_min(PlotterMicro_t<2>(h5, micro), Plots(type));
}
else
assert(false && "need 2d or 3d input data");
Expand Down
2 changes: 1 addition & 1 deletion drawbicyc/plot_fields.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void plot_fields(Plotter_t plotter, Plots plots)
try{
std::string title = "water vapour mixing ratio [g/kg]";
gp << "set title '" + title + " t = " << std::fixed << std::setprecision(2) << (double(at) * n["outfreq"] * n["dt"] / 60.) << "min'\n";
auto tmp = plotter.h5load_timestep(plotter.file, "rv", at * n["outfreq"]);
auto tmp = plotter.h5load_timestep(plotter.file, "rv", at * n["outfreq"]) * 1e3;
plotter.plot(gp, tmp);
}
catch(...){}
Expand Down
142 changes: 142 additions & 0 deletions drawbicyc/plot_qv_qc_2_6_10_min.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#include <unordered_set>
#include <iomanip>

#include "common.hpp"
#include "PlotterMicro.hpp"
#include <boost/tuple/tuple.hpp>
#include "plots.hpp"

template<class Plotter_t>
void plot_qv_qc_2_6_10_min(Plotter_t plotter, Plots plots)
{
using std::string;
auto& n = plotter.map;

blitz::firstIndex i;
blitz::secondIndex j;
blitz::Range all = blitz::Range::all();

Gnuplot gp;
init(gp, "plots/out_lgrngn_qv_qc_2_6_10_min.tex", 2, 3, n);
gp << "unset multiplot\n";
gp << "set pm3d map\n";
gp << "set terminal epslatex color size 5, 2.8\n";
gp << "set multiplot layout 2,3\n";

std::set<float> times = {120, 360, 600};

string XTICS = "set xtics scale .5 rotate by 60 ('' 0.0, '0.6' 30, '1.2' 60, '1.8' 90, '2.4' 120, '3.0' 150, '' 180); set xlabel 'x [km]'\n";
string NOXTICS = "set xtics scale .5 ('' 0.0, '' 30, '' 60, '' 90, '' 120, '' 150, '' 180); unset xlabel\n";
string YTICS = "set xtics scale .5 rotate by 60 ('' 0.0, '0.6' 30, '1.2' 60, '1.8' 90, '2.4' 120); set ylabel 'y [km]'\n";
string NOYTICS = "set xtics scale .5 rotate by 60 ('' 0.0, '' 30, '' 60, '' 90, '' 120); unset ylabel\n";
// Margins for each row resp. column
string TMARGIN = "set tmargin at screen .9; set bmargin at screen 0.5\n";
string BMARGIN = "set tmargin at screen 0.5; set bmargin at screen 0.1\n";

string LMARGIN = "set lmargin at screen 0.1; set rmargin at screen 0.36\n";
string LRMARGIN = "set lmargin at screen 0.36; set rmargin at screen 0.62\n";
string RMARGIN = "set lmargin at screen 0.62; set rmargin at screen 0.88\n";
//color palette
string PALETTE = "set colorbox\n";
string NOPALETTE = "unset colorbox\n";
//titles
string TITLEQV = "set title offset 0,-0.8 '$q_v$ [g/kg]'\n";
string TITLEQC = "set title offset 0,-0.8 '$q_c$ [g/kg]'\n";
string NOTITLE = "unset title\n";


gp << "set cbrange [0:8]\n";
gp << "set cbtics (0, 2, 4, 6, 8)\n";

// --- GRAPH a
gp << TMARGIN;
gp << LMARGIN;
gp << NOXTICS;
gp << YTICS;
gp << NOPALETTE;
gp << "set title offset 0, -0.8 '$q_v$ [g/kg], t = 2 min'\n";
try{
typename Plotter_t::arr_t tmp(plotter.h5load_timestep(plotter.file, "rv", 120) * 1e3);
std::cout << tmp;
plotter.plot(gp, tmp);
}
catch(...){}

// --- GRAPH b
gp << TMARGIN;
gp << LRMARGIN;
gp << NOXTICS;
gp << NOYTICS;
gp << NOPALETTE;
gp << "set title offset 0, -0.8 '$q_v$ [g/kg], t = 6 min'\n";
try{
typename Plotter_t::arr_t tmp(plotter.h5load_timestep(plotter.file, "rv", 320) * 1e3);
std::cout << tmp;
plotter.plot(gp, tmp);
}
catch(...){}

// --- GRAPH c
gp << TMARGIN;
gp << RMARGIN;
gp << NOXTICS;
gp << NOYTICS;
gp << PALETTE;
gp << "set title offset 0, -0.8 '$q_v$ [g/kg], t = 10 min'\n";
try{
typename Plotter_t::arr_t tmp(plotter.h5load_timestep(plotter.file, "rv", 600) * 1e3);
std::cout << tmp;
plotter.plot(gp, tmp);
}
catch(...){}


gp << "set cbrange [0:2]\n";
gp << "set cbtics (0, 0.5, 1, 1.5, 2)\n";

// --- GRAPH d
gp << BMARGIN;
gp << LMARGIN;
gp << XTICS;
gp << YTICS;
gp << NOPALETTE;
gp << "set title offset 0, -0.8 '$q_c$ [g/kg], t = 2 min'\n";
try{
// cloud water content
typename Plotter_t::arr_t tmp(plotter.h5load_ract_timestep(plotter.file, 60) * 1e3);
std::cout << tmp;
plotter.plot(gp, tmp);
}
catch(...){}

// --- GRAPH e
gp << BMARGIN;
gp << LRMARGIN;
gp << XTICS;
gp << NOYTICS;
gp << NOPALETTE;
gp << "set title offset 0, -0.8 '$q_c$ [g/kg], t = 6 min'\n";
try{
// cloud water content
typename Plotter_t::arr_t tmp(plotter.h5load_ract_timestep(plotter.file, 360) * 1e3);
std::cout << tmp;
plotter.plot(gp, tmp);
}
catch(...){}

// --- GRAPH f
gp << BMARGIN;
gp << RMARGIN;
gp << XTICS;
gp << NOYTICS;
gp << PALETTE;
gp << "set title offset 0, -0.8 '$q_c$ [g/kg], t = 10 min'\n";
try{
// cloud water content
typename Plotter_t::arr_t tmp (plotter.h5load_ract_timestep(plotter.file, 600) * 1e3);
std::cout << tmp;
plotter.plot(gp, tmp);
}
catch(...){}

}
3 changes: 2 additions & 1 deletion drawbicyc/plot_series.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,14 +915,15 @@ void plot_series(Plotter_t plotter, Plots plots)

std::cout << plt << " " << res_pos << res_prof << res_prof_std_dev << std::endl;
gp.send1d(boost::make_tuple(res_pos, res_prof));
oprof_file << res_prof ;
if(plot_std_dev)
{
oprof_file << res_prof_std_dev ;
res_prof = res_prof + res_prof_std_dev;
gp.send1d(boost::make_tuple(res_pos, res_prof));
res_prof = res_prof - 2*res_prof_std_dev;
gp.send1d(boost::make_tuple(res_pos, res_prof));
}
oprof_file << res_prof ;
// plot(gp, res);
} // var loop
}

0 comments on commit 232ae86

Please sign in to comment.