How to extract data from 3D matrix using shape file

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.

回答 (1 件)

KSSV
KSSV 2020 年 10 月 20 日

0 投票

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.

1 件のコメント

monish deshpande
monish deshpande 2020 年 10 月 21 日
I tried it now its taking unlimied time to process. Can you please tell any other way. also attaching sample files.

サインインしてコメントする。

製品

リリース

R2019b

質問済み:

2020 年 10 月 19 日

コメント済み:

2020 年 10 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by