making a geotiff file from a netcdf file

7 ビュー (過去 30 日間)
kalani Lakshani
kalani Lakshani 2020 年 9 月 18 日
コメント済み: kalani Lakshani 2020 年 9 月 18 日
I tried to convert my netcdf file in to a tiff file. The code i typed in the command window is,
filename='S2B_20190418_L2W_AOI.nc'
ncdisp(filename)
longitude=ncread(filename,'lon')
latitude=ncread(filename,'lat')
surface_442=ncread(filename,'rhos_442')
longitude = double(longitude)
latitude = double(latitude)
surface_442 = double(surface_442)
R = georasterref('RasterSize',size(surface_442),'LatitudeLimits',[39.1072,39.1093],........
'LongitudeLimits',[26.5640,26.5688]);
tiffile ='surface_442.tif'
geotiffwrite(tiffile,surface_442,R)
The last step generates an error of:
Error using tifflib
Unable to open TIFF file "surface_442.tif".
Error in Tiff (line 651)
obj.FileID = tifflib('open',filename,mode);
Error in geotiffwrite>writeGeoTiffFile (line 1482)
tiffObj = Tiff(filename, writeMode);
Error in geotiffwrite (line 271)
writeGeoTiffFile(filename, A, TiffTags, GeoTiffTags, rpcTag,
isClassicTIFF);
I am grateful if you can kindly help to figure this out.
  3 件のコメント
kalani Lakshani
kalani Lakshani 2020 年 9 月 18 日
Thank you very much for replying. It is 42 x 24.
kalani Lakshani
kalani Lakshani 2020 年 9 月 18 日
@KSSV Okay I did it by including the size. Thank you so much for the clarification.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeNetCDF についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by