Commit 361308ab authored by Modellers Operational's avatar Modellers Operational

Bug fixes for subset plot

parent 87ded12a
......@@ -30,9 +30,13 @@ labels = {'q2': 'Turbulent kinetic energy $(m^{2}s^{-2})$',
'volume': 'Node-based control water column volume $(m^{3})$'}
def plot_var(idx):
plot = pf.plot.Plotter(fvcom, figsize=(23, 18), cmap=cmap, cb_label=label, extend=extension, res=None)
plot = pf.plot.Plotter(fvcom, extents=extents, figsize=(23, 18), cmap=cmap, cb_label=label, extend=extension, res=None)
if var == 'zeta':
plot.plot_field(np.squeeze(getattr(fvcom.data, var))[idx, :])
else:
plot.plot_field(np.squeeze(getattr(fvcom.data, var))[idx, level, :])
plot.plot_field(np.squeeze(getattr(fvcom.data, var))[idx, level, :])
plot.tripcolor_plot.set_clim(clim[0], clim[1])
plot.axes.set_title(fvcom.time.Times[idx][:-7].replace('T', ' '))
......@@ -47,15 +51,19 @@ def plot_var(idx):
fname = sys.argv[1]
var = sys.argv[2]
clim = [float(sys.argv[3]), float(sys.argv[4])]
sub_lowerleft = [float(sys.argv[5]), float(sys.argv[6])]
sub_upperright = [float(sys.argv[7]), float(sys.argv[8])]
print(fname)
extents = np.asarray([float(sys.argv[5]),float(sys.argv[7]),float(sys.argv[6]),float(sys.argv[8])])
level=0
cmap = pt.plotting.pmlcmaps(var)
pool_size = 4
fvcom = pf.read.FileReader(fname, [var], subset=np.asarray([sub_lowerleft, sub_upperright]))
if var == 'uv':
fvcom = pf.read.FileReader(fname, ['u', 'v'])
setattr(fvcom.data, 'uv', np.sqrt(fvcom.data.u**2 + fvcom.data.v**2))
else:
fvcom = pf.read.FileReader(fname, [var])
label = labels[var]
extension = pt.plotting.colourbar_extension(*clim, getattr(fvcom.data, var).min(), getattr(fvcom.data, var).max())
level = 0
......
[command]
default = today_output=/${ARCHIVE_DIR}/${FORECAST_DAY}/${GRID_NAME}_0001.nc; echo ${today_output}
default = today_output=/${FVCOM_OUTPUT_DIR}/${FORECAST_DAY}/${FVCOM_GRID_NAME}_0001.nc
OIFS=$IFS
......@@ -7,28 +7,25 @@ default = today_output=/${ARCHIVE_DIR}/${FORECAST_DAY}/${GRID_NAME}_0001.nc; ech
subset_arr=(${SUBSET_LLS})
var_arr=(${SUBSET_VARS})
IFS=";"
for this_subset_params in "${subset_arr[@]}"; do
subset_name=${this_subset_params[0]}
subset_lon_lower_left=${this_subset_params[1]}
subset_lat_lower_left=${this_subset_params[2]}
subset_lon_upper_right=${this_subset_params[3]}
subset_lat_upper_right=${this_subset_params[4]}
subset_name=$(echo $this_subset_params | cut -f1 -d ';')
subset_lon_lower_left=$(echo $this_subset_params | cut -f2 -d ';')
subset_lat_lower_left=$(echo $this_subset_params | cut -f3 -d ';')
subset_lon_upper_right=$(echo $this_subset_params | cut -f4 -d ';')
subset_lat_upper_right=$(echo $this_subset_params | cut -f5 -d ';')
for this_var_params in "${var_arr[@]}"; do
this_var=${this_var_params[0]}
this_var_lower_lim=${this_var_params[1]}
this_var_upper_lim=${this_var_params[2]}
echo ${this_var}
echo ${this_var_lower_lim}
echo ${this_var_upper_lim}
this_var=$(echo $this_var_params | cut -f1 -d ';')
this_var_lower_lim=$(echo $this_var_params | cut -f2 -d ';')
this_var_upper_lim=$(echo $this_var_params | cut -f3 -d ';')
python3 plot_var.py ${today_output} ${this_var} ${this_var_lower_lim} ${this_var_upper_lim} ${subset_lon_lower_left} ${subset_lat_lower_left} ${subset_lon_upper_right} ${subset_lat_upper_right}
this_var_plot_dir=${OUTPUT_DIR}/${FORECAST_DAY}/subset_plots/${subset_name}/${this_var}
echo ${this_var_plot_dir}
mkdir -p /${this_var_plot_dir}
mv *.png /${this_var_plot_dir}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment