Can I display coastlines over an ease2 array using mpl basemap?

Yes, using mpl "basemap"


In [3]:
import mpl_toolkits.basemap.pyproj as pyproj
import netCDF4 as nc
import os
import numpy as np
from mpl_toolkits.basemap import Basemap

In [4]:
os.chdir("/home/vagrant/ipython_notebooks/gdal_test/data/")
d = nc.Dataset('nhtsw100e2_20030107_20030113.nc', 'r')
print d


<type 'netCDF4.Dataset'>
root group (NETCDF4_CLASSIC data model, file format UNDEFINED):
    Conventions: CF-1.6
    Metadata_Conventions: CF-1.6, Unidata Dataset Discovery v1.0, GDS v2.0
    standard_name_vocabulary: CF Standard Name Table (v22, 12 February 2013)
    id: nhtsw100e2_20030107_20030113.nc
    naming_authority: gov.nasa.eosdis
    reference: http://dx.doi.org/10.5067/MEASURES/CRYOSPHERE/nsidc-0531.001
    metadata_link: http://nsidc.org/api/metadata?id=nsidc-0531
    title: MEaSUREs Northern Hemisphere Terrestrial Snow Cover Extent Weekly 100km EASE-Grid 2.0
    product_version: v01r00
    summary: This NASA MEaSUREs Earth System Data Record (ESDR) merges daily Northern Hemisphere snow cover extents over land derived from two independently produced sources.  Variables include snow cover extent from the weekly NOAA/NCDC Northern Hemisphere Snow Cover Extent Climate Data Record (NH SCE CDR) and a gap-filled snow extent product derived from the Special Sensor Microwave/Imager (SSMI) and Special Sensor Microwave Imager/Sounder (SSMIS).  The NSIDC Land-Ocean-Coast-Ice (LOCI) mask derived from BU-MODIS land cover data is consistently applied to each variable.  Data are in a Northern Hemisphere equal area projection at 100 km resolution, and are contained in weekly netCDF files spanning from October 4, 1966 to December 31, 2012.
    keywords: EARTH SCIENCE > CRYOSPHERE > SNOW/ICE > SNOW COVER, EARTH SCIENCE > TERRESTRIAL HYDROSPHERE > SNOW/ICE > SNOW COVER
    keywords_vocabulary: NASA Global Change Master Directory (GCMD) Earth Science Keywords, Version 8.0
    platform: NOAA POES (Polar Orbiting Environmental Satellites), DMSP (Defense Meteorological Satellite Program), GOES (Geostationary Operational Environmental Satellite), METEOSAT, GMS (Japan Geostationary Meteorological Satellite), METOP, TERRA > Earth Observing System TERRA (AM-1), AQUA > Earth Observing System AQUA
    sensor: VISSR > Visible and Infrared Spin Scan Radiometer, VAS > VISSR Atmospheric Sounder, MODIS > Moderate-Resolution Imaging Spectroradiometer, AMSU-B > Advanced Microwave Sounding Unit-B, AMSR-E > Advanced Microwave Scanning Radiometer-EOS, SSMI > Special Sensor Microwave/Imager, SSMIS > Special Sensor Microwave Imager/Sounder, VIIRS > Visible-Infrared Imager-Radiometer Suite
    cdm_data_type: Grid
    source: ftp://data.ncdc.noaa.gov/cdr/snowcover/, ftp://sidads.colorado.edu/pub/DATASETS/nsidc0001_polar_stereo_tbs/
    date_created: 2014-09-09T16:19:30Z
    institution: Center for Environmental Prediction, Rutgers University
    geospatial_lat_units: degrees_north
    geospatial_lon_units: degrees_east
    geospatial_lat_min: 0
    geospatial_lat_max: 90
    geospatial_lon_min: -180
    geospatial_lon_max: 180
    spatial_resolution: 100 km
    time_coverage_start: 2003-01-07
    time_coverage_end: 2003-01-13
    license: No restrictions on access or use
    dimensions(sizes): time(1), rows(180), cols(180)
    variables(dimensions): int32 time(time), float32 latitude(rows,cols), float32 longitude(rows,cols), int8 merged_snow_cover_extent(time,rows,cols), int8 weekly_climate_data_record_snow_cover_extent(time,rows,cols), int8 passive_microwave_gap_filled_snow_cover_extent(time,rows,cols), |S1 coord_system()
    groups: 


In [8]:
data = d.variables["merged_snow_cover_extent"][0,:,:]
print np.shape(data)
print np.amin(data),np.amax(data)


(180, 180)
10 40

In [9]:
imshow(data)


Out[9]:
<matplotlib.image.AxesImage at 0x7f0294d04110>

In [18]:
def init_basemap() : 

    m = Basemap(width=100000*180, height=100000*180,
            resolution='l', projection='laea',
            lon_0=0., lat_0=90.)
    m.drawcoastlines(color='w')
    m.drawcountries()
    m.drawmeridians(np.arange(-180.,180.,20.),labels=[False,False,False,True])
    m.drawparallels(np.arange(10.,80.,20.), labels=[True,False,False,False])
    return m

In [21]:
figsize(12,10)
m = init_basemap()
img = m.imshow(np.flipud(data))
cb = m.colorbar(img,label='code')
title("Snow cover, 13 Jan 2003")


Out[21]:
<matplotlib.text.Text at 0x7f02885d2550>

In [9]: