Automate the code for data extraction

2 visualizaciones (últimos 30 días)
Debayan Mandal
Debayan Mandal el 26 de Sept. de 2022
Comentada: Mathieu NOE el 24 de Oct. de 2022
I have multiple files of satellite data . Need to extract the data for a particular lat and lon. I have write the code for single data . Needs to run the code for all the files existing in the folder . The names of the files are :
g4.timeAvgMap.OMNO2d_003_ColumnAmountNO2TropCloudScreened.20190516-20220531.71E_19N_93E_47N
g4.timeAvgMap.OMNO2d_003_ColumnAmountNO2TropCloudScreened.20190401-20190415.70E_17N_76E_22N
The code i have written :
clear all;
close all;
clc;
filename='Delhi test.nc'
no2=ncread(filename, 'OMNO2d_003_ColumnAmountNO2TropCloudScreened');
longitude=ncread(filename,'lon');
latitude=ncread(filename,'lat');
[x1,y1]=meshgrid(longitude,latitude);
[r1,c1]=find(x1==77.3750);
[r2,c2]=find(y1==28.6250);
cc=no2(r1(1),c2(1))
Needs to modify the code so that this could be run in multiple files and data (which will be point data for each file ) can be stored by different variable names
Thanks in advance .

Respuestas (1)

Mathieu NOE
Mathieu NOE el 26 de Sept. de 2022
hello
you can try this :
folder= pwd; % put here folder where wav files are
C=dir(fullfile(folder,'*.nc')); %list all nc files in folder
nFiles=numel(C);
for i= 1:nFiles
% load new data
filename = C(i).name;
no2=ncread(filename, 'OMNO2d_003_ColumnAmountNO2TropCloudScreened');
longitude=ncread(filename,'lon');
latitude=ncread(filename,'lat');
[x1,y1]=meshgrid(longitude,latitude);
[r1,c1]=find(x1==77.3750);
[r2,c2]=find(y1==28.6250);
cc{i}=no2(r1(1),c2(1));
end

Categorías

Más información sobre CubeSat and Satellites en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by