필터 지우기
필터 지우기

How to plot satellite data?

조회 수: 34 (최근 30일)
A.G. Bruno
A.G. Bruno 2019년 1월 8일
댓글: Meg Noah 2023년 4월 24일
I am currently working with IDL to plot spectral images of trace gases concentration from satellite observation (such as TROPOMI on S5P and IASI on Metop satellites) but I want to switch to MATLAB. In this process I am having several trouble:
  1. I can not find a function or a tool to read native format images (.nat extension).
  2. I read files in NetCDF or HDF5 formats but I can not find a good way to plot this data.
I attacched an example of what I am trying to obtain. If some one has an sample code I would be grateful if he shared it.
  댓글 수: 2
Clare Davis
Clare Davis 2019년 2월 1일
Hello, I am having the same trouble - did you get a good answer in the end? Thanks
Meg Noah
Meg Noah 2023년 4월 24일
I do not have a .nat extension file. Can you post one here?

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

답변 (3개)

Meg Noah
Meg Noah 2020년 1월 10일
편집: Meg Noah 2020년 1월 10일
Here's a solution
clc
close all
clear all
filename = 'W_XX-EUMETSAT-Darmstadt,HYPERSPECT+SOUNDING,METOPA+IASI_C_EUMP_20181108012658_62544_eps_o_l2.nc';
info = ncinfo(filename);
% to get a listing on console of variable names
varnames = {info.Variables.Name}';
idx = find(contains(varnames,'integrated_co') & ~contains(varnames,'integrated_co2'));
% learning about the data
Attributes = info.Variables(idx).Attributes;
for i = 1:length(Attributes)
if (isnumeric(Attributes(i).Value))
fprintf(1,'%s = %f\n',Attributes(i).Name,Attributes(i).Value);
else
fprintf(1,'%s = %s\n',Attributes(i).Name,Attributes(i).Value);
end
end
dataCO = ncread(filename,'integrated_co');
% they seem to have made the missing data value a really big value
minval = min(dataCO(:));
dataCO(dataCO == max(dataCO(:))) = -300;
maxval = max(dataCO(:));
fprintf(1,'minval = %f\n',minval);
fprintf(1,'maxval = %f\n',maxval);
minval = 2e-4;
maxval = 67e-4;
m = 63/(maxval-minval);
b = -m*minval;
scaleddataCO = uint8(m*dataCO+b);
scaleddataCO(dataCO<0) = nan; % missing data
colorvals = colormap(jet);
lat = ncread(filename,'lat');
lon = ncread(filename,'lon');
[ny,nx] = size(dataCO);
figure()
hold on
for i = 1:64
idx = find(scaleddataCO == i);
plot(lon(idx),lat(idx),'s', 'markerfacecolor',colorvals(i,:),'markeredgecolor','none');
end
xlim([-180 180])
ylim([-90 90]);
axis equal
axis tight
set(gca,'ytick',[-90 -60 -30 0 30 60 90]);
set(gca,'xtick',[-180 -150 -120 -90 -60 -30 0 30 60 90 120 150 180]);
grid on
box on
title('Integrated CO 10^{-4} kg/m^2');
colormap(jet)
hb = colorbar;
hb.Ticks = [0 0.2 0.4 0.6 0.8 1];
vals = linspace(2,67,6);
for j = 1:length(vals)
hb.TickLabels{j} = num2str(vals(j));
end
Here's how to plot it with map functions
hfig = figure('color','white','position',[32 200 1200 650]);
worldmap('World')
load coastlines
plotm(coastlat,coastlon,'k')
hfig.Name = 'Integrated CO';
hold on;
for i = 1:64
idx = find(scaleddataCO == i);
if (~isempty(idx))
plotm(lat(idx),lon(idx),'s', 'markerfacecolor',colorvals(i,:),'markeredgecolor','none');
end
end
title('Integrated CO 10^{-4} kg/m^2');
colormap(jet)
hb = colorbar('southoutside');
hb.Ticks = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1];
vals = linspace(2,67,11);
for j = 1:length(vals)
hb.TickLabels{j} = num2str(vals(j));
end
CO_Map.png
  댓글 수: 2
Visweshwaran R
Visweshwaran R 2020년 1월 27일
@Meg Noah, the code is well written and precise. I too faced the same problem in plotting the netCDF file for soil moisture data (ASCAT). While I try to adjust this code for my datasets, I faced a few problems.
1) After printing the min and max value. you have assigned the same with 2e-4 and 67e-4.What is the need for it?
2)While calculating 'm', you used 63, why?
3)Similarly, you used for loop till 64, why that number particularly?
I know these questions may be basic but I am struck and 5 min of your time will be really helpful to me.
Thank you in advance.
Hugo
Hugo 2023년 4월 24일
What would it look like without the missing data part?
I'm having trouble adapting the code to a random satellite ncDEF file cause it doesnt plot all my data

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


KSSV
KSSV 2019년 1월 8일
Reading netCDF files is very easy in MATLAB. You need to just know ncdisp, ncread ..once you have read the data use pcolor to get the data you wanted to plot.
  댓글 수: 7
KSSV
KSSV 2019년 1월 9일
What are the dimensions of each variable?
Try:
pcolor(lon,lat,int_co') ;
I have asked you to attach the data/ file so that you can get more help straight away.
A.G. Bruno
A.G. Bruno 2019년 1월 10일
It still doesn't work.
Sorry, I did not understand that you mean the data file. I've attached a dropbox link because the file is too large to upload it.
https://www.dropbox.com/s/2dkep0bzimms66m/W_XX-EUMETSAT-Darmstadt%2CHYPERSPECT%2BSOUNDING%2CMETOPA%2BIASI_C_EUMP_20181108012658_62544_eps_o_l2.7z?dl=0

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


ming lei
ming lei 2019년 3월 31일
I also encountered a similar problem. Is it finally solved?

카테고리

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