獵風者衛星 Triton
(使用Octave)

pkg load netcdf


#設定要分析的檔案名稱,並打開

filename = 'C:\fs7data\triton\20231114\TRITON_011718_20231113235048_roughness_windspeed_v1.0_nc';

ncid = netcdf.open(filename, 'NC_NOWRITE');


#資料參數的代號、格式

more

ncdisp(filename);

pkg load netcdf

pkg load io

pkg load mapping


folder_path = 'C:\fs7data\triton'; % 資料夾路徑

file_list = dir(fullfile(folder_path, '*_nc')); % 所有 .nc 檔案


results = []; % 用於存儲結果的數組


for i = 1:length(file_list)

    file_path = fullfile(folder_path, file_list(i).name);

    ncid = netcdf.open(file_path, 'NC_NOWRITE');

    

    try

        % 設定變數名稱

        wind_varid = netcdf.inqVarID(ncid, 'wind13_21');

        lon_varid = netcdf.inqVarID(ncid, 'splon');

        lat_varid = netcdf.inqVarID(ncid, 'splat');

        

        % 讀取數據

        wind_speed = netcdf.getVar(ncid, wind_varid);

        lon = netcdf.getVar(ncid, lon_varid);

        lat = netcdf.getVar(ncid, lat_varid);

        

        % 將經度從0-360範圍轉換為-180到180範圍

        lon(lon > 180) = lon(lon > 180) - 360;

        

        % 過濾風速小於0的數據

        valid_indices = find(wind_speed >= 0);

        wind_speed = wind_speed(valid_indices);

        lon = lon(valid_indices);

        lat = lat(valid_indices);

        

        % 合併數據到結果數組

        results = [results; lon(:), lat(:), wind_speed(:)];

    catch

        warning(['Error reading variables from file: ', file_list(i).name]);

    end

    

    % 關閉 NetCDF 文件

    netcdf.close(ncid);

end


% 將結果寫入 CSV 文件

csvwrite('C:\fs7data\results.csv', results);


% 繪製二維散點圖,使用風速進行著色

figure;

scatter(results(:, 1), results(:, 2), 36, results(:, 3), 'filled'); % 36 是點的大小

xlabel('Longitude');

ylabel('Latitude');

title('2023/11/14 TRITON wind speed (m/s)');

colorbar; % 添加顏色條


% 調整x軸和y軸範圍

xlim([-180 180]);

ylim([-90 90]);


% 讀取 Shapefile 文件

coastline = shaperead('C:\fs7data\ne_110m_coastline.shp');


% 繪製海岸線

hold on;

for k = 1:length(coastline)

    plot(coastline(k).X, coastline(k).Y, 'k'); % 使用黑色繪製海岸線

end

hold off;


% 設置 x 軸和 y 軸比例相同

axis equal;



2023/11/14-2023/12/31
全部的海面風速資料