MATLAB Answers

how to read a time series data at a particular (x, y) grid cell in a netcdf file

9 views (last 30 days)
Kuo-Hsien
Kuo-Hsien on 25 Apr 2013
Commented: Damith on 26 Mar 2014
Dear all,
The netcdf file was composited a dimension of x = 570 and y = 480.
How to extract a time series data at a particular grid cell in Matlab?
I've tried the nctoolbox, however the results are not identical with that in ncview. (ps. I guess the nctoolbox regard the (x, y) is the real longitude and latitude!?) So, I need to find the other solutions. Please see the attached the file at http://db.tt/WIqIt2u1
Please help me on this.
Thanks a lot.
Michael

Answers (1)

Ashish Uthama
Ashish Uthama on 25 Apr 2013
Edited: Ashish Uthama on 25 Apr 2013
Look at ncread (and ncdisp) if your version of MATLAB had it.
% time series of lon 120, lat 250
tpix = squeeze(ncread('/tmp/wetd.mon.nc','wetd',[120, 250, 1, 1], [1,1,1,12]))
tpix =
10.8050
8.4050
8.9470
6.0860
9.6200
11.8550
13.4120
11.5200
10.4780
7.6780
10.1200
9.4700
  1 Comment
Damith
Damith on 26 Mar 2014
hi,
I wanted to extract data using a netCDF file for a selected lat and long coordinate but this code did not work. Please see the attached file.
Any help is appreciated.
Thanks.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!