MPAS | xtime to pd.datetime MPAS xtime format 1234[[b'2023-01-01_00:00:00 '] [b'2023-01-01_12:08:00 '] [b'2023-01-02_00:06:17 '] [b'2023-01-02_12:04:35 ']] Convert to datetime 123456datetime = []tmp_datetime = dataset_base_atm["xtime"].values.astype(str)for px in range(tmp_datetime.shape[0]): datetime.append(tmp_datetime[px][0].strip())datetime = pd.to_datetime(datetime, format="%Y-%m-%d_%H:%M:%S") plotting 12345678910111213141516# Apply the 'ggplot' styleplt.style.use('ggplot')# Creates a figure with a width of 10 inches and a height of 5 inchesplt.figure(figsize=(16, 8))plt.plot(datetime, mean_t2m[0, :] - 273.15, 'ro-', label="default")plt.plot(datetime, mean_t2m[1, :].T - 273.15, 'bo-', label="SST updated")# Plot with default styleplt.title('t2m [degC]')plt.xlabel('Date Time')plt.ylabel('t2m [degC]')plt.legend()plt.show()plt.close() MPAS #NWP #MPAS MPAS | xtime to pd.datetime https://waipangsze.github.io/2025/06/20/MPAS-xtime-to-pd-datetime/ Author wpsze Posted on June 20, 2025 Updated on June 20, 2025 Licensed under MPAS | Long Term Run study Previous WRF | Intel OneAPI icx/ifx Next