Possible bug: time_after_ascent may have jumps
Some trajectories have shown jumps in time_after_ascent. This might be a bug or errors in the input data.
Plot:
import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
import pandas as pd
import hvplot.pandas # noqa
f = "/data/project/wcb/netcdf/local_vis_test/conv_400_0_traj_t000000_p001_met3d_mpi_version_ensemble.nc"
ds = xr.open_dataset(f, decode_times=False, engine="netcdf4")
df = ds.loc[{"trajectory": 7}].to_dataframe().reset_index()
df = df.loc[df["time"] >= 183200]
df = df.loc[df["time"] <= 183300]
print(ds["time"])
# df = df.loc[df["time"] <= 3000]
df.hvplot.scatter(x="time", y="time_after_ascent", by="trajectory", alpha=0.2, width=1900, height=600)
Script:
#!/bin/bash
# Run a sensitivity analysis of several ensembles with the top variables for qr
cd ..
# Set to the number of threads or CPUs in case you want to run ensemble simulations
NTASKS=4
# trajectory_sensitvity_perturbance 0
# trajectory_sensitivity 1
# trajectory_perturbance 2
# grid_sensitivity 3
SIMULATION_MODE="1"
AUTO_TYPE="3"
# Write to disk every WRITE_INDEX steps. If you experience I/O issues,
# then set it to a multiple of SNAPSHOT_INDEX
WRITE_INDEX="11000"
TIMESTEP="20"
# Get results every SNAPSHOT_INDEX steps, in this example every $TIMESTEP (20) seconds
SNAPSHOT_INDEX="1"
# Fix pressure, temperature and ascent during microphysics (=1)
# or take any changes of them into account (=0)
FIXED_ITERATION="0"
#
TRACK_FILE="configs/qr_vis_config.json"
# Wether to take the data from the netcdf-file every 20 seconds (=1)
# or just use the initial pressure, temperature and ascent
# from the file and simulate microphysics
# until the target time is reached (=0 not recommended)
START_OVER_ENVIRONMENT="1"
# Warm up time in seconds for the model before any data is tracked
WARM_UP="1800"
SUFF="_mpi_version_ensemble"
INPUT_PATH="/data/project/wcb/netcdf/vladiana_met_updated/"
# INPUT_PATH="/data/project/wcb/netcdf/vladiana_met_stats/"
# for FILENAME in "no_exclusions_conv_400_median"
# for FILENAME in "conv_400_0_traj_t000000_p001_met3d"
for INPUT_FILENAME in ${INPUT_PATH}*.nc_wcb
do
FILENAME=${INPUT_FILENAME##*/}
FILENAME=${FILENAME%.*}
PROGRESSBAR="500"
TARGET_TIME_AFTER_START=$(ncdump -h $INPUT_FILENAME | grep -m 1 "time = " | sed 's/[^0-9]//g' )
TARGET_TIME_AFTER_START=$(($TARGET_TIME_AFTER_START * 20 - 20))
echo "Running for ${FILENAME} until ${TARGET_TIME_AFTER_START} with ${NTASKS} tasks"
OUTPUT_PATH="/data/project/wcb/netcdf/local_vis_test/"
if [ ! -d "$OUTPUT_PATH" ]
then
mkdir -p "$OUTPUT_PATH"
fi
mpirun -n ${NTASKS} build/bin/./trajectories \
-w ${WRITE_INDEX} \
-a ${AUTO_TYPE} \
-t ${FIXED_ITERATION} \
-f ${TARGET_TIME_AFTER_START} \
-d ${TIMESTEP} \
-i ${SNAPSHOT_INDEX} \
-b ${SIMULATION_MODE} \
-o ${OUTPUT_PATH}${FILENAME}${SUFF}.nc \
-e ${START_OVER_ENVIRONMENT} \
-p ${PROGRESSBAR} \
-g "0" \
-l ${INPUT_FILENAME} \
-s ${TRACK_FILE} \
-u ${WARM_UP}
break
done