plot situ

import matplotlib.pyplot as plt
import numpy as np
x_v2_so = np.linspace(1, 25, 25)
x_v2 = np.linspace(1,28,28)
x_l_so = np.linspace(1,27,27)
x_l = np.linspace(1,28,28)
y_v2_so = [83.56, 87.83, 89.26, 90.27, 90.85, 89.98, 91.36, 92.73, 92.96, 93.78,
           94.01, 94.47, 95.12, 94.98, 96.12, 95.89, 96.91, 96.86, 96.99, 96.88,
           96.85, 97,    97,    97,     97]

y_v2    = [78.55,85.08,88.23,90.53,91.9,90.68,93.83,94.25,94.98,95.78,
          95.58,96.33,96.32,95.75,97.00,97.05,96.9,  96.81,96.8,96.95,
          96.9, 97.05, 97.1,97.1, 97.1, 97.1,97.11, 97.11]


y_l_so  = [92.78,95.41,96.23,96.53,97,  97.2, 97.31,96.91,97.01,97.18,
          97.43,97.48,97.61,97.75,97.4, 97.91,97.93,97.83,98.06,97.9,
          98.1 ,98.00,98.03,98.08,98.08,97.95,98.03]

y_l     = [92.21,95.38,96.38,97.38,97.53,97.8,97.78,97.65,97.85,97.96,
          98.31,98.1 ,98.26,98.26,98.35,98.36,98.23,98.48,98.42,98.3,
          98.43,98.42,98.3 ,98.4 ,98.5 ,98.56,98.48 ,98.48]



plt.plot(x_v2_so,y_v2_so, 'g', linewidth=1,marker='D',markersize=4,label='a: mobilenet v2(softmax + Triplet)')
plt.plot(x_v2,y_v2,   'b', linewidth=1,marker='o',markersize=4,label='b: mobilenet v2(AM-softmax + Triplet)')
plt.plot(x_l_so,y_l_so, 'k', linewidth=1,marker='^',markersize=5,label='c: L-mobilenet v2(softmax + Triplet)')

plt.plot(x_l,y_l,    'r', linewidth=1,marker='*',markersize=5,label='d: L-mobilenet v2(AM-softmax + Triplet)')

plt.xlim(0, 30)



plt.text(29, 98.5, 'd')
plt.text(29, 97.5, 'c')
plt.text(29, 96.5, 'b')
plt.text(25, 96, 'a')
# plt.scatter(x,y,"o")

# ax1 = plt.gca()
# # ax1.set_title("tutu")
# ax1.set_xlabel('epochs')
# ax1.set_ylabel('acc/%')

plt.xlabel('epochs')
plt.ylabel('acc/%')
plt.legend()
plt.show()


clc; clear; % 设置文件名 filename = 'dataset-armor-3d-nrt-monthly_1760169273385.nc'; % 读取坐标变量 lon = ncread(filename, 'longitude'); % 经度 lat = ncread(filename, 'latitude'); % 纬度 depth = ncread(filename, 'depth'); % 深度(米),size: 22x1 time_num = ncread(filename, 'time'); % 时间点(秒 since 1970) % 转换时间(取第一个时间步) time_dt = datetime(1970,1,1) + seconds(time_num); target_time_idx = 1; % 第一个时间步 % 读取温盐数据:维度 [lon, lat, depth, time] temp = ncread(filename, 'to'); % 温度 (°C) salt = ncread(filename, 'so'); % 盐度 (PSU) % 提取第一个时间步的所有层温度和盐度 % size: [92, 88, 22] Temp_all = temp(:, :, :, target_time_idx); % [nx, ny, nz] Salt_all = salt(:, :, :, target_time_idx); % 初始化输出数组 [nx, ny, nz] = size(Temp_all); rho_actual = zeros(nx, ny, nz); % 现场密度 (kg/m³) sigma_theta = zeros(nx, ny, nz); % 位势密度 sigma_0 (kg/m³ - 1000) % 计算每个纬度对应的近似重力加速度(用于压力转换) % 注意:lat 是 88x1 向量,需要插值到网格点 [~, ~] = meshgrid(lon, lat); % lat_grid: 88x92 % 循环每个深度层进行计算 for k = 1:nz z = depth(k); % 当前深度(米) % 将当前层的温度和盐度提取为二维平面 [92,88] T_slice = Temp_all(:,:,k); % 92x88 S_slice = Salt_all(:,:,k); % 创建与数据匹配的纬度矩阵(每层相同) lat_rep = repmat(lat', nx, 1)'; % 复制成 92x88,每一列是 lat % === 步骤1:计算压力(dbar)=== % 近似公式:p ≈ depth * 1.025 * 9.8 / 10 → 更准确应使用 gsw_p_from_z % 推荐使用 GSW 函数计算压力(单位:dbar) try p = gsw_p_from_z(z, lat_rep); % 压力随纬度变化修正 catch error('GSW Toolbox 未安装!请下载并添加至路径。'); end % 展平用于输入 GSW 函数 T_flat = T_slice(:); S_flat = S_slice(:); p_flat = p(:); % === 步骤2:计算现场密度(in-situ density)=== rho_flat = gsw_rho_t_exact(S_flat, T_flat, p_flat); % 单位 kg/m³ % === 步骤3:计算位势密度(potential density at surface pressure)=== % 先求出将水样绝热抬升到表面后的“位势温度” pt_flat = gsw_pt_from_t(S_flat, T_flat, p_flat, 0); % 再计算该水样在表面压力下的密度(σ₀ = ρ - 1000) sigma0_flat = gsw_rho_t_exact(S_flat, pt_flat, 0) - 1000; % 重塑回原始空间结构 rho_actual(:,:,k) = reshape(rho_flat, nx, ny); sigma_theta(:,:,k) = reshape(sigma0_flat, nx, ny); end % ==== 可视化:绘制表层(第一层)的现场密度和 σ₀ 分布图 ==== figure; % 子图1:现场密度(第1层) subplot(1,2,1); [lon_grid, lat_grid] = meshgrid(lon, lat); surf_plot1 = rho_actual(:,:,1)'; m_proj('miller','lon',[min(lon) max(lon)],'lat',[min(lat) max(lat)]); m_contourf(lon_grid, lat_grid, surf_plot1, 50, 'linestyle', 'none'); shading flat; m_coast('patch',[0.7 0.7 0.7]); m_grid('box','on'); colorbar; title('In-situ Density (kg/m^3) - Surface'); colormap(cmocean('dense')); % 推荐用于密度 % 子图2:位势密度 σ₀ subplot(1,2,2); surf_plot2 = sigma_theta(:,:,1)'; m_proj('miller','lon',[min(lon) max(lon)],'lat',[min(lat) max(lat)]); m_contourf(lon_grid, lat_grid, surf_plot2, 50, 'linestyle', 'none'); shading flat; m_coast('patch',[0.7 0.7 0.7]); m_grid('box','on'); colorbar; title('\sigma_0 (kg/m^3 - 1000) - Surface'); colormap(cmocean('dense')); sgtitle(['Potential and In-situ Density - ', datestr(time_dt(1), 'yyyy-mm')]); 去掉上面代码中检测工具箱是否正常工作的代码
10-12
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值