How to scale the data with matric of lon (1300 x 1300) and lat (1300 x 1300) ?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear all,
I'm analyzing the data related to atmosphere. My data have structure like
longitute (1300 x 1300): from 95.5132 - 131.7989 E
latitute (1300 x 1300): from 4.5498 - 31.8399 N
data (1300 x 1300): data information.
Now I want to cutting the region (data) into 118 - 124E, 20 - 28N.
First, I try to find the index of matrix with "find" command:
>> lon_region = find((geo.lon > 118) & (geo.lon < 124));
>> lat_region = find((geo.lon > 20) & (geo.lon < 28));
But the results outcome are lat_region with 487820x1 double and lon_region with 370264x1 double.
Based on this result, I cannot extract the data region from original one.
In my points of view, I struggles with the maxtric format of "lon" and "lat" that cause me confusion and don't know how to deal with it. I think it may be deal with "loop function" but I would take long time, so there is any ways to deal with ?
Please help and thank you very much in advance
0 commentaires
Réponse acceptée
Simon Chan
le 31 Oct 2022
Use idexing as follows and please verify the variable names you are using.
lon_idx = (geo.lon > 118) & (geo.lon < 124); % Range for lon
lat_idx = (geo.lat > 20) & (geo.lat < 28); % Range for lat
valid_idx = lon_idx & lat_idx; % Range for lon & lat
lon_region = geo.lon(valid_idx); % Extract the lon_region
lat_region = geo.lat(valid_idx); % Extract the lat_region
data_region = geo.data(valid_idx); % Extract the data (NOT sure the variable name for yoru data)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Octave 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!