Please help . I want to exert precipitation data from nc file .
3 views (last 30 days)
Show older comments
Reza E Rabby
on 25 Jan 2018
Commented: Walter Roberson
on 29 Jan 2018
Three dimension lat , lon , time . Three hour interval data that means eight precipitation data in a day.
filename='267523.cmorph_precip.cmorph.3hr-025deg.20030102.nc'
ncdisp(filename)
time=ncread(filename,'time')
lon=ncread(filename,'lon')
lat=ncread(filename,'lat')
Some of code given here . If it is possible provide me the code .
Thank you
0 Comments
Accepted Answer
Walter Roberson
on 25 Jan 2018
cmorph_precip = ncread(filename, 'cmorph_precip');
After that, you can do things like
isosurface(lat, lon, time, cmorph_precip, 0.3)
Notice here that lat and lon had to be exchanged for isosurface. Your data has lon as the first coordinate, with MATLAB normally storing 3D data having the Y coordinate first but your data storing the X coordinate first. Just be aware if this if you try to xlabel or ylabel: x and y might be reversed from what you expect.
2 Comments
Walter Roberson
on 29 Jan 2018
lat_to_query = 88.5;
long_to_query = 22.5;
time_to_query = 0;
lat_idx = interp1(lat, 1:length(lat), lat_to_query, 'nearest');
lon_idx = interp1(long, 1:length(long), long_to_query, 'nearest');
time_idx = interp1(time, 1:length(time), time_to_query, 'nearest');
desired_precip = cmorph_precip(lon_idx, lat_idx, time_idx);
You can query multiple points at the same time using the above code: just make sure that the _to_query variables are vectors the same length (repeat data as needed) and same orientation, and the desired_precip will then be a vector with the same number of values.
This code deliberately looks for the nearest defined data. In some situations where you are dealing with precipitation in adjacent catch basins, you need to use 'previous' instead of 'nearest' so that you query the data for the cell that the location is in instead of querying the closest location.
More Answers (0)
See Also
Categories
Find more on Weather and Atmospheric Science in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!