Georeference MODIS L2 files
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I want to georeference MODIS L2 files in Matlab. The files has reflectance bands and Latitude and Longitude. I want to use WGS 84. While I am using m_proj this way.
m_proj('Mercator','longitude',([round(min(longitude(:,1)))-0.5 round(max(longitude(:,1)))+0.5]),'latitude',([round(min(latitude(1,:)))-0.5 round(max(latitude(1,:)))+0.5]));
image=m_pcolor(longitude,latitude,Rrs412);shading flat;
m_gshhs_f('patch',[.5 .5 .5],'edgecolor','none');
m_grid('linewi',2,'tickdir','out','box','fancy','fontsize',16);
m_ruler([.7 1],.9,'tickdir','out','ticklen',[.007 .007],'fontsize',12);
h=colorbar;
set(get(h,'ylabel'),'String',Rrs412,'fontsize',16);
colormap(m_colmap('jet'));
caxis([.001, 2]);
brighten(.2)
Where Rrs412 is one of the bands. I am getting a georefernced image (find in the screenshot). But how can I write reprojected netcdf files the same as showig in m_proj?
0 comentarios
Respuestas (1)
Balaji
el 4 de Sept. de 2023
Hi Arnub,
The m_map package is not supported by MATLAB. But to write into reprojected netcdf files you can use this as an example :
[x, y] = m_ll2xy(longitude, latitude);
% Create new NetCDF file
ncid = netcdf.create('reprojected_file.nc', 'CLOBBER');
% Define dimensions
dimid_x = netcdf.defDim(ncid, 'x', size(x, 2));
dimid_y = netcdf.defDim(ncid, 'y', size(y, 1));
% Define variables
varid_lat = netcdf.defVar(ncid, 'latitude', 'double', dimid_y);
varid_lon = netcdf.defVar(ncid, 'longitude', 'double', dimid_x);
varid_var = netcdf.defVar(ncid, 'variable', 'double', [dimid_y dimid_x]);
% Write data to variables
netcdf.putVar(ncid, varid_lat, lat);
netcdf.putVar(ncid, varid_lon, lon);
netcdf.putVar(ncid, varid_var, variable);
For more information on netcdf please refer to:
For more information on m_map please refer to:
Hope this helps!
Thanks
Balaji
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!