How do I extract the data corresponding to specific latitude and longitude from this 1x1 structure?

2 views (last 30 days)
I have a .mat file with Irradiance data for all of germany stored in a 1x1 struct but I only want the data for one specific combination of longitude and latitude.
GHI =
struct with fields:
title: 'global radiation on horizontal plain on ground for COSMO-EU-grid (point-in-time-measured values, source: HC3-satellite data)'
region: 'DEU'
year: '2021'
timezone: 'UTC'
timestep: '60 min'
unit: 'W/m^2'
lat: [55.0529 54.9266 54.8655 54.8679 54.8690 54.8700 54.8709 54.8065 54.8075 54.8084 54.8092 ]
lon: [8.4235 8.3198 8.4304 8.6468 8.7550 8.8632 8.9714 8.7568 8.8649 8.9729 9.0810 9.1890 ]
time: [8760×1 double]
data: [8760×7383 uint16]
the data I need is stored in the 'data' field and the lat and lon values I need are : 48 and 11.
How do I extract the data ?
>>

Answers (1)

dpb
dpb on 15 Sep 2023
lat=48;
lon=11;
ixLat=find(GHI.lat==lat);
ixLon=find(GHI.lon==lon);
vals=GHI.data(ixLat,ixLon);

Tags

Products

Community Treasure Hunt

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

Start Hunting!