Help subsetting data from a .nc file

8 visualizaciones (últimos 30 días)
Brian Bartlett
Brian Bartlett el 30 de Jul. de 2018
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!

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by