Help subsetting data from a .nc file

조회 수: 8 (최근 30일)
Brian Bartlett
Brian Bartlett 2018년 7월 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개)

카테고리

Help CenterFile Exchange에서 NetCDF에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by