Automate the code for data extraction

2 vues (au cours des 30 derniers jours)
Debayan Mandal
Debayan Mandal le 26 Sep 2022
Commenté : Mathieu NOE le 24 Oct 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 .

Réponses (1)

Mathieu NOE
Mathieu NOE le 26 Sep 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
  1 commentaire
Mathieu NOE
Mathieu NOE le 24 Oct 2022
hello
problem solved ?

Connectez-vous pour commenter.

Catégories

En savoir plus sur CubeSat and Satellites dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by