目录

画图

横坐标添加月份

Python

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np

# 准备时间和温度数据
start_date = pd.to_datetime('1996-12-01') # the next date
end_date = pd.to_datetime('1998-12-01') # the current data, so 36
time_index = pd.date_range(start_date, end_date, freq='M')
temperature_data = np.random.uniform(0, 40, len(time_index))  # 这里使用随机温度数据,您应该替换为您的实际数据
print("shape:",temperature_data.shape)
# 创建时间序列图
plt.figure(figsize=(12, 6))
plt.plot(time_index, temperature_data, marker='o', linestyle='-')
plt.title('Temperature-Time-Series')
plt.xlabel('Time')
plt.ylabel('Temperature')
plt.xticks(rotation=45)  # 旋转x轴标签以包含月份
plt.grid(True)
plt.show()

Matlab

startYear = 2023;startMonth=1;endYear=2023;endMonth=12;
time_index = datetime(startYear,startMonth, 1):calmonths(1):datetime(endYear,endMonth, 1);
plot(time_index,rand(length(time_index),1));

空间映射

标准化

To = 1:10;        % 实际观测数据
Tm = 30:-1:21;    % 模型数据
% 标准化To和Tm序列
standardized_To = (To - mean(To)) / std(To);
standardized_Tm = (Tm - mean(Tm)) / std(Tm);

% 获取原始To中最后一个点在标准化后的To中的位置
relative_position = (To(5) - mean(To)) / std(To);

% 根据相对位置在标准化后的Tm中找到对应的值
% 使用unique确保样本点的唯一性
[unique_standardized_Tm, unique_idx] = unique(standardized_Tm);
corresponding_Tm_value = interp1(unique_standardized_Tm, Tm(unique_idx), relative_position);

disp('To序列:');
disp(To);
disp('对应的Tm序列:');
disp(corresponding_Tm_value);
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。