How to extract data from 3D matrix using shape file
3 views (last 30 days)
Show older comments
I am working on an atmospheric trasport model output. The output is in format of Netcdf file for each day of month. Some of attributs of the fiel are as follows:
Projection: Lambart Conformal
Latitude: 307X407X1
Longitude: 307X407X1
Vertical Levels: 39X1
I have extracted required variables with diamentions as follows:
(anthropogenic)Ant: 307X407X39
(Biomass)Bbu: 307X407X39
(Background)Bck: 307X407X39
(Biogenic)Bio: 307X407X39
(Total)TOT: 307X407X39
(Pressure)Press: 307X407X39
I have processed each level for entire region but now want to extract data over my study region. I tried inpolygon and Maskregion (from file exchange) but it shows following error
Out of memory. Type "help memory" for your options.
Error in meshgrid (line 62)
yy = repmat(ycol,size(xrow));
Error in maskregion (line 40)
[xx,yy]=meshgrid(filelon,filelat);
Initially I thought the problem is related to difference in projection system of shp file but even after using same projections I am getting same error. Its problem with meshgrid. Is there any way to solve this?
I tried attching sample.mat file and .shp file of my study region for reference but its too big. Please help me to figure this out.
0 Comments
Answers (1)
KSSV
on 20 Oct 2020
Your lon, lat are already matrices...you need not to use meshgrid. You are creating unnecessary data.
lon = squeeze(filelon) ;
lat = squeeze(filelat) ;
That's it you have your grid coordinates.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!