Plotting a map by extracting data in time intervals from a netcdf file
23 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Thishan Dharshana
le 11 Fév 2023
Commenté : Walter Roberson
le 12 Fév 2023
My netcdf file has longitude, latitude, month, and monthly mean temperature. Data are for 10 years. I have to get the average for each month (ie mean for all January months over 10 years, mean for all February months over 10 years, etc). Data file sizes are 180 for latitude, 360 for longitude, 120 for month and monthly mean temperatures. Size of the final answer should be 360 x 180 x12.
Then I need to get the standard deviation and make a plot of it.
Please help me with this.
1 commentaire
Walter Roberson
le 11 Fév 2023
If you ncread() the monthly mean temperature, is the result an array that is (number of longitude) by (number of latitude) by (12) by (number of years) ? Something else?
Data file sizes are 180 for latitude, 360 for longitude, 120 for month and monthly mean temperatures.
So when you ncread() the monthly mean temperature, the result is 360 x 180 x 120 ? Please verify this explicitly: it would be common in netcdf files to instead find that the data was 180 x 360 x 120 .
Réponse acceptée
Walter Roberson
le 11 Fév 2023
data_by_year = reshape(YourData, size(YourData,1), size(YourData,2), 12, []);
mean_by_month_over_years = mean(data_by_year, 4);
std_by_month_over_years = std(data_by_year, [], 4);
2 commentaires
Walter Roberson
le 12 Fév 2023
Well you have a problem that you have 2d data for each of 12 months
contourm(Data_lat, Data_lon, std_by_month_over_years(:,:,MonthNumber))
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur NetCDF dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!