Please help . I want to exert precipitation data from nc file .
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Reza E Rabby
el 25 de En. de 2018
Comentada: Walter Roberson
el 29 de En. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 25 de En. de 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 comentarios
Walter Roberson
el 29 de En. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Weather and Atmospheric Science en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!