Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workshop #5

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0bd2561
back to gcc11
ryba183 May 5, 2020
2d9567d
Cloud Top Height
ryba183 Jul 23, 2020
a894010
Python3 update
ryba183 Jul 23, 2020
bdfc97a
Lasher_Trapp_ICMW
ryba183 Aug 5, 2020
590c633
Merge branch 'master' into Workshop
ryba183 Aug 5, 2020
ed62eef
Update latex_labels.py
ryba183 Aug 6, 2020
d0f3ba5
looking for error
ryba183 Aug 12, 2020
100aa74
Merge branch 'Workshop' of https://github.com/ryba183/UWLCM_plotting …
ryba183 Aug 13, 2020
3533d88
ICMW2020
ryba183 Aug 13, 2020
6f1c66b
Revert "Update latex_labels.py"
ryba183 Aug 13, 2020
a88d8fb
working
ryba183 Aug 13, 2020
c94291f
LWM
ryba183 Aug 28, 2020
5fa75f9
time series
ryba183 Sep 4, 2020
590c1fe
profs
ryba183 Sep 22, 2020
c0db4f2
ICMW_profs
ryba183 Sep 23, 2020
0e35c11
NC_vs_AF python3
ryba183 Sep 24, 2020
cde1e02
Workshops
ryba183 Oct 8, 2020
86c5545
ICMW_CC_2020
ryba183 Dec 3, 2020
d6ea764
Merge branch 'master' into Workshop
ryba183 Dec 3, 2020
4e3157d
working_on_rysy
ryba183 Dec 8, 2020
d0a1d85
Adiabatic Fraction ICMW2020
ryba183 Apr 15, 2021
3cf79dc
Merge branch 'Workshop' of https://github.com/ryba183/UWLCM_plotting …
ryba183 Apr 15, 2021
46ead79
preparation for randomness
ryba183 Aug 2, 2021
af2e716
paper prepare
ryba183 Aug 16, 2021
5a12c36
plots for paper
Aug 31, 2021
0990d78
plots for paper vol3
Sep 6, 2021
9ceb2c4
plots for paper vol4
Sep 8, 2021
60e67e7
cleaning
ryba183 Sep 8, 2021
ebedd07
cleaning
ryba183 Sep 8, 2021
41e1ba0
beter cloud base
ryba183 Sep 10, 2021
4114ec6
plots for paper vol4
Sep 10, 2021
c0ce1ba
plots for paper vol4
Sep 10, 2021
41e588d
plots for paper vol5
Sep 10, 2021
c0bf157
ICM maintenance problems
ryba183 Jan 1, 2022
c3413e6
Distribution plots
ryba183 Jan 20, 2022
a9202bc
RYSY
ryba183 Feb 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Matplotlib_common/latex_labels.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
var_labels = {

"lwp" : 'LWP [kg m$^{-2}$]',
"rwp" : 'RWP [kg m$^{-2}$]',
"cwp" : 'CWP [kg m$^{-2}$]',
"lwm" : 'LWM [kg]',
"cwm" : 'CWM [kg]',
"rwm" : 'RWM [kg]',
"sgs_tke" : 'SGS TKE (Smagorinsky) [m$^{2}$ s$^{-2}$]',
"sgs_tke_sd" : 'SGS TKE (Super-droplets) [m$^{2}$ s$^{-2}$]',
"lwp" : 'LWP [g m$^{-2}$]',
"rwp" : 'RWP [g m$^{-2}$]',
"surf_precip" : 'Surface precip. [mm/day]',
"acc_precip" : 'Accumulated precip. [mm]',
"acc_precip_vol" : 'Accumulated precip. [m^3]',
"cl_nc" : '$N_c$ [cm$^{-3}$] (cloudy cells)',
"cl_nr" : '$N_{r>25\mu m}$ [cm$^{-3}$]',
"cl_gccn_conc" : '$N_{GCCN}$ [cm$^{-3}$] (cloudy cells)',
Expand All @@ -23,6 +29,8 @@
"er" : 'Entrainment rate [cm s$^{-1}$]',
"wvarmax" : 'Max. $w$ variance [m$^{2}$ s$^{-2}$]',
"cloud_base" : 'Cloud base height [m]',
"cloud_top_height" : 'Cloud top height [m]',
"total_droplets_number" : 'Total Number of Cloud and Rain Droplets [#]',
"gccn_rw_cl" : '$<r>$ of GCCN droplets (cloudy cells) [um]',
"non_gccn_rw_cl" : '$<r>$ of CCN droplets (cloudy cells) [um]',
"clb_bigrain_mean_rd" : '$<r_d>$ of (r$>$40um) @ clbase [m]',
Expand Down
3 changes: 2 additions & 1 deletion Matplotlib_common/plot_profs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def plot_profiles(var_list, plot_iter, nplotx, nploty, axarr, xscaledict, yscale
print file_name
# try:
profiles_file = open(file_name, "r")
my_pos = read_my_var(profiles_file, "position")
## my_pos = read_my_var(profiles_file, "position")
my_pos = read_my_var(profiles_file, "time")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When plotting profiles, my_pos is altitude, not time.
If you want to change from position to time in plot_series, please change from position to altitude in plot_profs.
That may require additional changes in matplotlib code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still to be done

my_res = read_my_var(profiles_file, var)
profiles_file.close()

Expand Down
5 changes: 3 additions & 2 deletions Matplotlib_common/plot_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ def plot_series(var_list, plot_iter, nplotx, nploty, axarr, xscaledict, yscaledi
for file_name in file_names:
print file_name, var
series_file = open(file_name, "r")
my_times = read_my_var(series_file, "position")
#my_times = read_my_var(series_file, "position")
my_time = read_my_var(series_file, "time")
my_res = read_my_var(series_file, var)

# rescale time to hours
my_times = my_times / 3600.
my_times = my_times / 3600. ##H

series_file.close()

Expand Down
2 changes: 1 addition & 1 deletion Matplotlib_common/read_UWLCM_arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def read_my_array(file_obj):
line = line.split(" ")
del line[0]
del line[len(line)-1]
arr = map(float,line)
arr =list( map(float,line))
ryba183 marked this conversation as resolved.
Show resolved Hide resolved
return np.array(arr), arr_name

def read_my_var(file_obj, var_name):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
from matplotlib import rc
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator, MultipleLocator

import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../Matplotlib_common/")

from plot_ranges import xscaledict, yscaledict, xlimdict_series, ylimdict_series
from plot_series import *

# activate latex text rendering
rc('text', usetex=True)

ICMW2020_vars = ["RH_max", "cloud_top_height", "surf_precip", "acc_precip", "acc_vol_precip"]

# init the plot
nplotx = 2
nploty= 3
fig, axarr = plt.subplots(nplotx,nploty)

plot_series( ICMW2020_vars, 0, nplotx, nploty, axarr, xscaledict, yscaledict, xlimdict_series, ylimdict_series, xlabel='Time [h]')

# legend font size
plt.rcParams.update({'font.size': 8})

# hide axes on empty plots
if len( ICMW2020_vars) % nploty == 0:
nemptyplots = 0
else:
nemptyplots = nploty - len( ICMW2020_vars) % nploty
emptyplots = np.arange(nploty - nemptyplots, nploty)
for empty in emptyplots:
axarr[nplotx-1, empty].axis('off')

# hide hrzntl tic labels
x_empty_label = np.arange(0, nplotx-1)
y_empty_label = np.arange(nploty)
for x in x_empty_label:
for y in y_empty_label:
axarr[x,y].set_xticklabels([])

#axes = plt.gca()
#axes.tick_params(direction='in')
x_arr = np.arange(nplotx)
y_arr = np.arange(nploty)
for x in x_arr:
for y in y_arr:
#tics inside
axarr[x,y].tick_params(direction='in', which='both', top=1, right=1)
#minor tics
axarr[x,y].xaxis.set_minor_locator(AutoMinorLocator())
axarr[x,y].yaxis.set_minor_locator(AutoMinorLocator())
#labels and tics font size
for item in ([axarr[x,y].xaxis.label, axarr[x,y].yaxis.label] + axarr[x,y].get_xticklabels() + axarr[x,y].get_yticklabels()):
item.set_fontsize(8)
# subplot numbering
if y < nploty - nemptyplots or x < (nplotx - 1):
axarr[x,y].text(0.2, 0.9, labeldict[y + x*nploty], fontsize=8, transform=axarr[x,y].transAxes)

#single legend for the whole figure
handles, labels = axarr[0,0].get_legend_handles_labels()

lgd = fig.legend(handles, labels, handlelength=4, loc='lower center', bbox_to_anchor=(0.45,0))

#figure size
fig.set_size_inches(7.874, 5. + (len(labels) - 2) * 0.2)# 5.214)#20.75,13.74)
#distances between subplots and from bottom of the plot
fig.subplots_adjust(bottom=0.18 + (len(labels) - 2) * 0.03, hspace=0.1, wspace=0.4)

#fig.tight_layout(pad=0, w_pad=0, h_pad=0)

#plt.show()
fig.savefig(argv[len(sys.argv)-1], bbox_inches='tight', dpi=300)#, bbox_extra_artists=(lgd,))
124 changes: 124 additions & 0 deletions cases/ICMW2020_cumulus_congestus/plot_ranges.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
xscaledict = {
"thl" : "linear",
"00rtot" : "linear",
"rliq" : "linear",
"prflux" : "linear",
"cl_nc" : "linear",
"clfrac" : "linear",
"wvar" : "linear",
"w3rd" : "linear",
"sat_RH" : "linear",
"rad_flx" : "linear",
"lwp" : "linear",
"RH_max" : "linear",
"cloud_top_height" : "linear",
"total_droplets_number" : "linear",
"acc_precip_vol" : "linear",
"rwp" : "linear",
"er" : "linear",
"wvarmax" : "linear",
"surf_precip" : "linear",
"acc_precip" : "linear",
"cloud_base" : "linear",
"gccn_rw_cl" : "linear",
"non_gccn_rw_cl" : "linear",
"base_prflux_vs_clhght" : "log",
"cl_gccn_conc" : "linear"
}

yscaledict = {
"thl" : "linear",
"00rtot" : "linear",
"rliq" : "linear",
"prflux" : "linear",
"cl_nc" : "linear",
"clfrac" : "linear",
"wvar" : "linear",
"w3rd" : "linear",
"sat_RH" : "linear",
"rad_flx" : "linear",
"lwp" : "linear",
"RH_max" : "linear",
"cloud_top_height" : "linear",
"total_droplets_number" : "linear",
"ac_precip_vol" : "linear",
"rwp" : "linear",
"er" : "linear",
"wvarmax" : "linear",
"surf_precip" : "linear",
"acc_precip" : "linear",
"cloud_base" : "linear",
"gccn_rw_cl" : "linear",
"non_gccn_rw_cl" : "linear",
"base_prflux_vs_clhght" : "linear",
"cl_gccn_conc" : "log"
}

xlimdict_profs = {
"thl" : None,
"00rtot" : None,
"rliq" : None,
"prflux" : (0,20),
"cl_nc" : (0,90),
"clfrac" : None,
"wvar" : None,
"w3rd" : None,
"sat_RH" : None,
##"RH_max" : None,
##"cloud_top_height" : None,
"rad_flx" : None,
"gccn_rw_cl" : (0,90),
"non_gccn_rw_cl" : (0,12),
"base_prflux_vs_clhght" : (1,10000)
}
ylimdict_profs = {
"thl" : (0,3000),
"00rtot" : (0,3000),
"rliq" : (0,3000),
"prflux" : (0,3000),
"cl_nc" : (0,3000),
"clfrac" : (0,3000),
"wvar" : (0,3000),
"w3rd" : (0,3000),
"sat_RH" : (0,3000),
"rad_flx" : (0,3000),
"RH_max" : (0,3000),
"cloud_top_height" : (0,3000),
"gccn_rw_cl" : (0,3000),
"non_gccn_rw_cl" : (0,3000),
"base_prflux_vs_clhght" : (0,2500)
}

xlimdict_series = {
"clfrac" : None,
"cl_nc" : None,
"lwp" : None,
"RH_max" : None,
"cloud_top_height" : None,
"total_droplets_number" : None,
"rwp" : None,
"er" : None,
"wvarmax" : None,
"surf_precip" : None,
"acc_precip" : None,
"acc_precip_vol" : None,
"cl_gccn_conc" : None,
"cloud_base" : None
}

ylimdict_series = {
"clfrac" : None,
"cl_nc" : None,
"lwp" : None,
"RH_max" : None,
"cloud_top_height" : None,
"total_droplets_number" : None,
"acc_precip_vol" : None,
"rwp" : None,
"er" : None,
"wvarmax" : None,
"surf_precip" : None,
"acc_precip" : None,#(0,0.07),
"cl_gccn_conc" : (1e-6, 1),
"cloud_base" : None
}
20 changes: 20 additions & 0 deletions cases/Lasher_Trapp/plot_ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"sat_RH" : "linear",
"rad_flx" : "linear",
"lwp" : "linear",
"RH_max" : "linear",
pdziekan marked this conversation as resolved.
Show resolved Hide resolved
"cloud_top_height" : "linear",
"total_droplets_number" : "linear",
"acc_precip_vol" : "linear",
"rwp" : "linear",
"er" : "linear",
"wvarmax" : "linear",
Expand All @@ -34,6 +38,10 @@
"sat_RH" : "linear",
"rad_flx" : "linear",
"lwp" : "linear",
"RH_max" : "linear",
"cloud_top_height" : "linear",
"total_droplets_number" : "linear",
"acc_precip_vol" : "linear",
"rwp" : "linear",
"er" : "linear",
"wvarmax" : "linear",
Expand All @@ -56,6 +64,8 @@
"wvar" : None,
"w3rd" : None,
"sat_RH" : None,
"RH_max" : None,
"cloud_top_height" : None,
"rad_flx" : None,
"gccn_rw_cl" : (0,90),
"non_gccn_rw_cl" : (0,12),
Expand All @@ -72,6 +82,8 @@
"w3rd" : (0,3000),
"sat_RH" : (0,3000),
"rad_flx" : (0,3000),
"RH_max" : (0,3000),
"cloud_top_height" : (0,3000),
"gccn_rw_cl" : (0,3000),
"non_gccn_rw_cl" : (0,3000),
"base_prflux_vs_clhght" : (0,2500)
Expand All @@ -81,11 +93,15 @@
"clfrac" : None,
"cl_nc" : None,
"lwp" : None,
"RH_max" : None,
"cloud_top_height" : None,
"total_droplets_number" : None,
"rwp" : None,
"er" : None,
"wvarmax" : None,
"surf_precip" : None,
"acc_precip" : None,
"acc_precip_vol" : None,
"cl_gccn_conc" : None,
"cloud_base" : None
}
Expand All @@ -94,6 +110,10 @@
"clfrac" : None,
"cl_nc" : None,
"lwp" : None,
"RH_max" : None,
"cloud_top_height" : None,
"total_droplets_number" : None,
"acc_precip_vol" : None,
"rwp" : None,
"er" : None,
"wvarmax" : None,
Expand Down
6 changes: 3 additions & 3 deletions drawbicyc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ foreach(exe drawbicyc plot_series_compare average)
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
)
# enabling c++14
target_compile_features(${exe} PUBLIC cxx_std_14)
# enabling c++11
# target_compile_features(${exe} PUBLIC cxx_std_11)
#target_compile_features(${exe} PUBLIC cxx_std_14)
#enabling c++11
target_compile_features(${exe} PUBLIC cxx_std_11)
target_link_libraries(${exe} PRIVATE uwlcm::uwlcm_includes)
target_link_libraries(${exe} PRIVATE ${HDF5_LIBRARIES})
target_include_directories(${exe} PUBLIC ${HDF5_INCLUDE_DIRS})
Expand Down
6 changes: 3 additions & 3 deletions drawbicyc/drawbicyc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main(int argc, char** argv)
("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, rico, Lasher_Trapp")//, base_prflux_vs_clhght")
("type", po::value<std::string>()->required(), "one of: dycoms, moist_thermal, rico, Lasher_Trapp, ICMW2020")//, base_prflux_vs_clhght")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change ICMW2020 to ICMW2020_cc to distinguish that this is the cumulus congestus case

;

po::variables_map vm;
Expand All @@ -33,8 +33,8 @@ int main(int argc, char** argv)

// handling the "type" option
std::string type = vm["type"].as<std::string>();
if(type != "dycoms" && type != "moist_thermal" && type != "rico" && type != "pi_chamber" && type != "Lasher_Trapp")
throw std::runtime_error("Unrecognized 'type' option, only dycoms, rico, moist_thermal, pi_chamber, Lasher_Trapp available now");//, base_prflux_vs_clhght available now");
if(type != "dycoms" && type != "moist_thermal" && type != "rico" && type != "pi_chamber" && type != "Lasher_Trapp" && type != "ICMW2020")
throw std::runtime_error("Unrecognized 'type' option, only dycoms, rico, moist_thermal, pi_chamber, Lasher_Trapp, ICMW2020 available now");//, base_prflux_vs_clhght available now");

// should profiles be normalized by inversion height
const bool normalize_prof = type == "dycoms";
Expand Down
4 changes: 2 additions & 2 deletions drawbicyc/include/drawbicyc/Plotter3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Plotter_t<3> : public PlotterCommon
auto h5load(
const string &file,
const string &dataset,
bool srfc = false // load a horiznotal slice
bool srfc = false // load a horizontal slice
) -> decltype(blitz::safeToReturn(arr_t() + 0))
{
parent_t::h5load(file, dataset);
Expand Down Expand Up @@ -189,7 +189,7 @@ class Plotter_t<3> : public PlotterCommon
this->map["dz"] = tmp(0,0,1) - tmp(0,0,0);
this->CellVol = this->map["dx"] * this->map["dy"] * this->map["dz"];
this->DomainSurf = this->map["dx"] * this->map["dy"] * this->map["x"] * this->map["y"];

this->DomainVolume = this->map["dx"] * this->map["dy"] * this->map["dz"] * this->map["x"] * this->map["y"] * this->map["z"];

// other dataset are of the size x*z, resize tmp
tmp.resize(n[0]-1, n[1]-1, n[2]-1);
Expand Down
2 changes: 1 addition & 1 deletion drawbicyc/include/drawbicyc/PlotterCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PlotterCommon
const string file;
std::map<std::string, double> map;
blitz::Array<float, 1> timesteps, p_e;
double CellVol, DomainSurf;
double CellVol, DomainSurf, DomainVolume;

protected:
H5::H5File h5f;
Expand Down
Loading