필터 지우기
필터 지우기

Georeference arbitrarily orientated matrix with corresponding lat/lon data

조회 수: 1 (최근 30일)
Grant
Grant 2017년 11월 6일
답변: KSSV 2017년 11월 7일
I have a 12 x 12 matrix of data ('data'). I also have a 12 x 12 matrix of the corresponding latitudes ('lat')of each cell and another for the longitudes ('lon') of each cell. I need to save the data as a geotiff and cannot find a way to do so. The difficulty comes from the fact lat/lon do not run along parallels/meridians so my efforts with 'georasterref' where you supply the min/max lat/lon of the matrix have failed.
For example, a portion of the lat matrix:
80.3483276367188 80.3870162963867 80.4255905151367
80.3793334960938 80.4181365966797 80.4568405151367
80.4101943969727 80.4491195678711 80.4879379272461
And the lon matrix:
-60.8070793151856 -60.9964065551758 -61.1872444152832
-60.5792732238770 -60.7683334350586 -60.9589118957520
-60.3500404357910 -60.5388183593750 -60.7291259765625
These data were extracted from a netcdf file

채택된 답변

KSSV
KSSV 2017년 11월 7일
How about doing interpolation and convert it to regular grid and then write to geotiff?
lat = [80.3483276367188 80.3870162963867 80.4255905151367
80.3793334960938 80.4181365966797 80.4568405151367
80.4101943969727 80.4491195678711 80.4879379272461];
lon = [-60.8070793151856 -60.9964065551758 -61.1872444152832
-60.5792732238770 -60.7683334350586 -60.9589118957520
-60.3500404357910 -60.5388183593750 -60.7291259765625];
data = rand(size(lon)) ; % some random data
%%Make regular grid
x0 = min(lon(:)) ; x1 = max(lon(:)) ;
y0 = min(lat(:)) ; y1 = max(lat(:)) ;
x = linspace(x0,x1,3) ; y = linspace(y0,y1,3) ;
[X,Y] = meshgrid(x,y) ;
Z = griddata(lon,lat,data,X,Y) ;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 NetCDF에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by