Help subsetting data from a .nc file
조회 수: 8 (최근 30일)
이전 댓글 표시
I have a netcdf file, presenting lat and long as 182x149 matrices each, and then SST data presented as 182x149xtime, with time being number of days. I am trying to subset all three matrices to specific ranges (specifically lats between 8 and 40, and longs between 270 and 300). When i subset my lat and long, the results are 1 dimensional matrices of indices, and thus I cannot use them to in turn subset the SST data. Here's my current code to subset lat and long:
lat = ncread('tos_IPSL.nc', 'lat'); long = ncread('tos_IPSL.nc', 'lon'); %%Here matrices are 182x149
my_lat=find(lat>8 & lat<40); my_long=find(long>270 & long<300); lat_subset=lat(my_lat); long_subset=long(my_long); %%These are now 3638x1 for lat and 2243x1 for long
This unfortunately means I cannot use them to subset my SST files... any help would be greatly appreciated!
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 NetCDF에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!