Cannot read NC file dimensions values and regrid them
Ältere Kommentare anzeigen
Hello,
I'm trying tot rescale coordinates in the .nc file that has one variable.
ncfile = 'my_file.nc';
ncdisp(ncfile) produces this result;
Format: netcdf4_classic
Dimensions:
lat = 234
lon = 288
Variables:
var
Size: 234x288
Dimensions: lat,lon
Datatype: double
info = ncinfo(ncfile);
dim_lat = info.Variables(strcmp({info.Variables.Name}, 'swr')).Dimensions(strcmp({info.Variables(strcmp({info.Variables.Name}, 'var')).Dimensions.Name}, 'lat')).Name;
dim_lon = info.Variables(strcmp({info.Variables.Name}, 'swr')).Dimensions(strcmp({info.Variables(strcmp({info.Variables.Name}, 'var')).Dimensions.Name}, 'lon')).Name;
But then I'm getting an error when I'm trying to read the values:
lat_existing = ncread(ncfile, dim_lat);
lon_existing = ncread(ncfile, dim_lon);
Error using internal.matlab.imagesci.nc/getGroupAndVarid
Could not find variable or group 'lat' in file.
Error in internal.matlab.imagesci.nc/read (line 648)
[gid, varid] = getGroupAndVarid(this, location);
Error in ncread (line 76)
vardata = ncObj.read(varName, varargin{:});
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Map Customization finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!