필터 지우기
필터 지우기

Im having a ASCAT satellite data and i need to regrid 500m resolution data to 2.225 km .

조회 수: 12 (최근 30일)
Since the satellite data are available in different resolutions and projections, all the data were resampled to 2.225-km spatial resolution and in the BYU projection for comparative analysis. please provide a code for this regridding.

답변 (1개)

Keerthi Reddy
Keerthi Reddy 2023년 6월 30일
Hi Amrutha, here is a sample code which you may use, but please, make sure to add necessary changes wherever required.
% Load the satellite data
% Assuming you have a variable named 'satelliteData' containing the original data
% Define the desired resolution and projection
targetResolution = 2.225; % in kilometers
targetProjection = 'BYU'; % replace with the desired projection name
% Define the grid for the target resolution
targetGridSize = 1 / targetResolution; % grid size in degrees
targetLatitudes = -90:targetGridSize:90;
targetLongitudes = -180:targetGridSize:180;
% Create a meshgrid for the target grid
[lonTarget, latTarget] = meshgrid(targetLongitudes, targetLatitudes);
% Resample the satellite data to the target grid
regriddedData = interp2(lonOriginal, latOriginal, satelliteData, lonTarget, latTarget, 'linear');
% Plot the regridded data
imagesc(targetLongitudes, targetLatitudes, regriddedData);
colorbar;
title('Regridded Satellite Data');
xlabel('Longitude');
ylabel('Latitude');
The variables latOriginal and lonOriginal contain the original longitude and latitude values of the satellite data. Also to mention, the above code uses bilinear interpolation, you can feel free to use any kind of interpolation method that suits your data.
I hope this helps.
  댓글 수: 1
amrutha anna
amrutha anna 2023년 7월 5일
as im using this codes, it is showing error as unrecognised function lonOrginial. so i modified the code as given below
% Load the satellite data
% Assuming you have a variable named 'satelliteData' containing the original data
% Define the original grid size (in meters)
originalGridSize = 500;
% Define the desired resolution and projection
targetResolution = 2.225; % in kilometers
targetProjection = 'BYU'; % replace with the desired projection name
% Define the grid for the target resolution
targetGridSize = 1 / targetResolution; % grid size in degrees
targetLatitudes = -90:targetGridSize:90;
targetLongitudes = -180:targetGridSize:180;
% Create a meshgrid for the target grid
[lonTarget, latTarget] = meshgrid(targetLongitudes, targetLatitudes);
% Define the original grid for the satellite data
originalLatitudes = -90:originalGridSize/1000:90;
originalLongitudes = -180:originalGridSize/1000:180;
[lonOriginal, latOriginal] = meshgrid(originalLongitudes, originalLatitudes);
% Resample the satellite data to the target grid
regriddedData = interp2(lonOriginal, latOriginal, satelliteData, lonTarget, latTarget, 'linear');
% Plot the regridded data
imagesc(targetLongitudes, targetLatitudes, regriddedData);
colorbar;
title('Regridded Satellite Data');
still, it is showing error as error using griddedinterpolant Sample value must be of type double or single
please provide a solution for this.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Scenario Generation and Visualization에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by