Basemap npstere projection returns blank map without data
I am trying to make a plot of sea ice concentration over the North Pole using a Polar Stereographic Projection with Basemap. The map returned has all the formatting done to the projection but doesn't have any data. I'm able to make a plot with a cylindrical projection using the same data, but when I change the projection over to 'npstere' it is blank. I've tried different datasets but the map is blank no matter what dataset I use.
Here is the map produced (screenshot, the saved plot is just blank)
Blank_map
Here is my code,
I am using Python3.5, Matplotlib 2.2.2, and Basemap 1.0.7
# load packages
%matplotlib inline
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
# load data
icedata = xr.open_dataset('IceData/G10010_SIBT1850_v1.1_JF.nc', decode_times=False)
seaice_1850 = icedata.seaice_conc_JF[0]
# make map projection
map_fig = Basemap(projection='npstere', boundinglat=50 ,lon_0=0)
# get lat/lon formatted
lon_1d = icedata.longitude.values
lat_1d = icedata.latitude.values
lon_2d, lat_2d = np.meshgrid(lon_1d, lat_1d)
# plot data over map
map_fig.pcolormesh(lon_2d, lat_2d, seaice_1850, cmap='jet')
# make it pretty
map_fig.drawcoastlines()
map_fig.drawparallels(np.arange(-80.,81.,10.))
map_fig.drawmeridians(np.arange(-180.,181.,20.))
plt.colorbar()
plt.show()
python-3.x matplotlib plot matplotlib-basemap
add a comment |
I am trying to make a plot of sea ice concentration over the North Pole using a Polar Stereographic Projection with Basemap. The map returned has all the formatting done to the projection but doesn't have any data. I'm able to make a plot with a cylindrical projection using the same data, but when I change the projection over to 'npstere' it is blank. I've tried different datasets but the map is blank no matter what dataset I use.
Here is the map produced (screenshot, the saved plot is just blank)
Blank_map
Here is my code,
I am using Python3.5, Matplotlib 2.2.2, and Basemap 1.0.7
# load packages
%matplotlib inline
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
# load data
icedata = xr.open_dataset('IceData/G10010_SIBT1850_v1.1_JF.nc', decode_times=False)
seaice_1850 = icedata.seaice_conc_JF[0]
# make map projection
map_fig = Basemap(projection='npstere', boundinglat=50 ,lon_0=0)
# get lat/lon formatted
lon_1d = icedata.longitude.values
lat_1d = icedata.latitude.values
lon_2d, lat_2d = np.meshgrid(lon_1d, lat_1d)
# plot data over map
map_fig.pcolormesh(lon_2d, lat_2d, seaice_1850, cmap='jet')
# make it pretty
map_fig.drawcoastlines()
map_fig.drawparallels(np.arange(-80.,81.,10.))
map_fig.drawmeridians(np.arange(-180.,181.,20.))
plt.colorbar()
plt.show()
python-3.x matplotlib plot matplotlib-basemap
Does setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call change anything ? If no, would you mind providing your data file ?
– Patol75
Nov 13 '18 at 6:35
Thank you! That worked, I had a feeling it was something wrong with the coordinates but I'm not experienced enough to know what was wrong.
– Sarah Thunberg
Nov 13 '18 at 19:38
add a comment |
I am trying to make a plot of sea ice concentration over the North Pole using a Polar Stereographic Projection with Basemap. The map returned has all the formatting done to the projection but doesn't have any data. I'm able to make a plot with a cylindrical projection using the same data, but when I change the projection over to 'npstere' it is blank. I've tried different datasets but the map is blank no matter what dataset I use.
Here is the map produced (screenshot, the saved plot is just blank)
Blank_map
Here is my code,
I am using Python3.5, Matplotlib 2.2.2, and Basemap 1.0.7
# load packages
%matplotlib inline
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
# load data
icedata = xr.open_dataset('IceData/G10010_SIBT1850_v1.1_JF.nc', decode_times=False)
seaice_1850 = icedata.seaice_conc_JF[0]
# make map projection
map_fig = Basemap(projection='npstere', boundinglat=50 ,lon_0=0)
# get lat/lon formatted
lon_1d = icedata.longitude.values
lat_1d = icedata.latitude.values
lon_2d, lat_2d = np.meshgrid(lon_1d, lat_1d)
# plot data over map
map_fig.pcolormesh(lon_2d, lat_2d, seaice_1850, cmap='jet')
# make it pretty
map_fig.drawcoastlines()
map_fig.drawparallels(np.arange(-80.,81.,10.))
map_fig.drawmeridians(np.arange(-180.,181.,20.))
plt.colorbar()
plt.show()
python-3.x matplotlib plot matplotlib-basemap
I am trying to make a plot of sea ice concentration over the North Pole using a Polar Stereographic Projection with Basemap. The map returned has all the formatting done to the projection but doesn't have any data. I'm able to make a plot with a cylindrical projection using the same data, but when I change the projection over to 'npstere' it is blank. I've tried different datasets but the map is blank no matter what dataset I use.
Here is the map produced (screenshot, the saved plot is just blank)
Blank_map
Here is my code,
I am using Python3.5, Matplotlib 2.2.2, and Basemap 1.0.7
# load packages
%matplotlib inline
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
# load data
icedata = xr.open_dataset('IceData/G10010_SIBT1850_v1.1_JF.nc', decode_times=False)
seaice_1850 = icedata.seaice_conc_JF[0]
# make map projection
map_fig = Basemap(projection='npstere', boundinglat=50 ,lon_0=0)
# get lat/lon formatted
lon_1d = icedata.longitude.values
lat_1d = icedata.latitude.values
lon_2d, lat_2d = np.meshgrid(lon_1d, lat_1d)
# plot data over map
map_fig.pcolormesh(lon_2d, lat_2d, seaice_1850, cmap='jet')
# make it pretty
map_fig.drawcoastlines()
map_fig.drawparallels(np.arange(-80.,81.,10.))
map_fig.drawmeridians(np.arange(-180.,181.,20.))
plt.colorbar()
plt.show()
python-3.x matplotlib plot matplotlib-basemap
python-3.x matplotlib plot matplotlib-basemap
asked Nov 12 '18 at 20:11
Sarah ThunbergSarah Thunberg
161
161
Does setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call change anything ? If no, would you mind providing your data file ?
– Patol75
Nov 13 '18 at 6:35
Thank you! That worked, I had a feeling it was something wrong with the coordinates but I'm not experienced enough to know what was wrong.
– Sarah Thunberg
Nov 13 '18 at 19:38
add a comment |
Does setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call change anything ? If no, would you mind providing your data file ?
– Patol75
Nov 13 '18 at 6:35
Thank you! That worked, I had a feeling it was something wrong with the coordinates but I'm not experienced enough to know what was wrong.
– Sarah Thunberg
Nov 13 '18 at 19:38
Does setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call change anything ? If no, would you mind providing your data file ?
– Patol75
Nov 13 '18 at 6:35
Does setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call change anything ? If no, would you mind providing your data file ?
– Patol75
Nov 13 '18 at 6:35
Thank you! That worked, I had a feeling it was something wrong with the coordinates but I'm not experienced enough to know what was wrong.
– Sarah Thunberg
Nov 13 '18 at 19:38
Thank you! That worked, I had a feeling it was something wrong with the coordinates but I'm not experienced enough to know what was wrong.
– Sarah Thunberg
Nov 13 '18 at 19:38
add a comment |
1 Answer
1
active
oldest
votes
Setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call does the trick.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269402%2fbasemap-npstere-projection-returns-blank-map-without-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call does the trick.
add a comment |
Setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call does the trick.
add a comment |
Setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call does the trick.
Setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call does the trick.
answered Nov 14 '18 at 1:30
Patol75Patol75
6236
6236
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269402%2fbasemap-npstere-projection-returns-blank-map-without-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Does setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call change anything ? If no, would you mind providing your data file ?
– Patol75
Nov 13 '18 at 6:35
Thank you! That worked, I had a feeling it was something wrong with the coordinates but I'm not experienced enough to know what was wrong.
– Sarah Thunberg
Nov 13 '18 at 19:38