- Plot a mean of ten lines of different resolution - Help Center - MATLAB & Simulink (mathworks.com) – They have used the exact same data and you could refer to how they have loaded the data and plotted maps.
How do I create a series of maps from a regional sample of a global dataset?
2 views (last 30 days)
Show older comments
I am trying to create maps for 1000/2000 year time slices of temperature and biome data for Europe from which I can analyse the affects thereof upon prehistoric populations. Ideally, I would have plotted the data for different latitudes in Europe on a linegraph but this would completely beyond me. The ncread function yielded such a large volume of data that it never actually finished loading. I have attached usage notes for the public data below. This paper to which this corresponds is 'Beyer et al. (2020). High-resolution terrestrial climate, bioclimate and vegetation for the last 120,000 years'. Any guidance on how to create the time-slice maps would be deeply appreciated. I am looking to create a biome map, temperature map, and precipitation map for each 1000/2000 year timeslice from 120,000 kBP to 4,000 kBP.
%% Global biome map
subplot(2,2,1);
imagesc(longitude, latitude, biome(:,:, years == my_year)'); axis xy;
title(['Biome distribution, 10000 BP']);
%% Global temperature map
subplot(2,2,2);
imagesc(longitude, latitude, temperature(:,:, months == my_month, years == my_year)'); axis xy;
colorbar;
title(['Mean June temperature, 10000 BP']);
% use nearest grid points (alternatively, use 3D interpolation)
[~,lonID] = min(abs(longitude - my_longitude));
[~,latID] = min(abs(latitude - my_latitude));
[~,yearID] = min(abs(years - my_year));
Having tried various combinations of coordinates as well as the use of the words verbatim I have made no progress. Quite simply, despite my efforts over a great many hours, I have no idea what I am doing. Unfortunately, programming and coding are not my fields, and it is not feasible to learn the software in detail for this particular research project. Again, any assistance would be most appreciated.
I do hope I have included the requisite detail in this question. Having spent some time perusing the guidance on asking questions I was left even more unsure of how to frame it than I was before. Evidently, I am not functioning at capacity at this present moment.
0 Comments
Answers (1)
Kausthub
on 28 Aug 2023
Hi Robert,
I understand that you are facing a problem loading the data using the ncread() function i.e., it is taking a lot of time to load, and confused about how to create the biome, temperature, and precipitation time-slice maps.
I have gone through the provided usage notes and loading using ncread() and, plotting using imagesc() works perfectly for me. The code I have used is:
clear; clc; close all;
file = 'LateQuaternary_Environment.nc';
%% Read variables from NetCDF file
longitude = ncread(file, 'longitude');
latitude = ncread(file, 'latitude');
years = ncread(file, 'time');
months = ncread(file, 'month');
temperature = ncread(file, 'temperature');
biome = ncread(file, 'biome');
%% Specify relevant point in time and space
my_year = -10000; % 10,000 BP
my_month = 6; % June
my_longitude = 0.1218;
my_latitude = 52.2053; % Cambridge, UK
figure(1);
%% Global biome map
subplot(2,2,1);
imagesc(longitude, latitude, biome(:,:, years == my_year)'); axis xy;
title(['Biome distribution, 10000 BP']);
%% Global temperature map
subplot(2,2,2);
imagesc(longitude, latitude, temperature(:,:, months == my_month, years == my_year)'); axis xy;
colorbar;
title(['Mean June temperature, 10000 BP']);
% use nearest grid points (alternatively, use 3D interpolation)
[~,lonID] = min(abs(longitude - my_longitude));
[~,latID] = min(abs(latitude - my_latitude));
[~,yearID] = min(abs(years - my_year));
%% Monthly temperature distribution
subplot(2,2,3);
plot(months, squeeze(temperature(lonID, latID, :, yearID)), '-o');
title(['Monthly temperature distribution, Cambridge (UK), 10000 BP']);
xticks(1:12); xlabel("Month");
ylabel('Mean temperature');
%% Mean annual temperature time series
mean_annual_temperature = mean(temperature,3);
subplot(2,2,4);
plot(years, squeeze(mean_annual_temperature(lonID, latID, :)), '-o');
title(['Mean annual temperature time series, Cambridge (UK)']);
xlabel('Year');
Here is an ML Answer related to your question:
A few references for plotting:
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!