Basemap npstere projection returns blank map without data












3














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()









share|improve this question






















  • 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
















3














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()









share|improve this question






















  • 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














3












3








3


1





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()









share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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


















  • 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












1 Answer
1






active

oldest

votes


















0














Setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call does the trick.






share|improve this answer





















    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    Setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call does the trick.






    share|improve this answer


























      0














      Setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call does the trick.






      share|improve this answer
























        0












        0








        0






        Setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call does the trick.






        share|improve this answer












        Setting the latlon keyword to True in the pcolormesh (matplotlib.org/basemap/api/basemap_api.html) call does the trick.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 14 '18 at 1:30









        Patol75Patol75

        6236




        6236






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Florida Star v. B. J. F.

            Danny Elfman

            Lugert, Oklahoma