In [1]:
import cartopy.crs as ccrs

Transforming points in one crs to another, e.g. OSGB (Ordinance Survey Great Britain to Geodetic


In [2]:
osgb = ccrs.OSGB()
geod = ccrs.Geodetic()

# Convert from Ordnance Survey GB to lon/lat:
easting = 291813.424
northing = 92098.387

lon, lat = geod.transform_point(
    x=easting, y=northing, src_crs=osgb)
print(lon, lat)


-3.533885175986329 50.71841091955379

In [6]:
# check with mapx, this is UL corner of EASE-Grid 2.0 N!
e2n = ccrs.LambertAzimuthalEqualArea(central_latitude=90.0)
lon, lat = geod.transform_point(
    x = -9000000.,
    y = 9000000.,
    src_crs=e2n)
print(lon, lat)


-135.0 -84.6340496694687

You can project lines with multiple vertices also:


In [10]:
import shapely.geometry as sgeom

new_york = [-74.0060, 40.7128] # lon, lat
honolulu = [-157.8583, 21.3069] # lon, lat

line = sgeom.LineString([new_york, honolulu])
pc = ccrs.PlateCarree()

lines = pc.project_geometry(line, pc)
lines


Out[10]:

In [8]:
help(lines)


Help on MultiLineString in module shapely.geometry.multilinestring object:

class MultiLineString(shapely.geometry.base.BaseMultipartGeometry)
 |  A collection of one or more line strings
 |  
 |  A MultiLineString has non-zero length and zero area.
 |  
 |  Attributes
 |  ----------
 |  geoms : sequence
 |      A sequence of LineStrings
 |  
 |  Method resolution order:
 |      MultiLineString
 |      shapely.geometry.base.BaseMultipartGeometry
 |      shapely.geometry.base.BaseGeometry
 |      builtins.object
 |  
 |  Methods defined here:
 |  
 |  __init__(self, lines=None)
 |      Parameters
 |      ----------
 |      lines : sequence
 |          A sequence of line-like coordinate sequences or objects that
 |          provide the numpy array interface, including instances of
 |          LineString.
 |      
 |      Example
 |      -------
 |      Construct a collection containing one line string.
 |      
 |        >>> lines = MultiLineString( [[[0.0, 0.0], [1.0, 2.0]]] )
 |  
 |  shape_factory(self, *args)
 |  
 |  svg(self, scale_factor=1.0, stroke_color=None)
 |      Returns a group of SVG polyline elements for the LineString geometry.
 |      
 |      Parameters
 |      ==========
 |      scale_factor : float
 |          Multiplication factor for the SVG stroke-width.  Default is 1.
 |      stroke_color : str, optional
 |          Hex string for stroke color. Default is to use "#66cc99" if
 |          geometry is valid, and "#ff3333" if invalid.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __geo_interface__
 |      Dictionary representation of the geometry
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from shapely.geometry.base.BaseMultipartGeometry:
 |  
 |  __eq__(self, other)
 |      Return self==value.
 |  
 |  __getitem__(self, index)
 |  
 |  __iter__(self)
 |  
 |  __len__(self)
 |  
 |  __ne__(self, other)
 |      Return self!=value.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from shapely.geometry.base.BaseMultipartGeometry:
 |  
 |  __array_interface__
 |      Provide the Numpy array protocol.
 |  
 |  coords
 |      Access to geometry's coordinates (CoordinateSequence)
 |  
 |  ctypes
 |      Return ctypes buffer
 |  
 |  geoms
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from shapely.geometry.base.BaseMultipartGeometry:
 |  
 |  __hash__ = None
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from shapely.geometry.base.BaseGeometry:
 |  
 |  __and__(self, other)
 |  
 |  __del__(self)
 |  
 |  __or__(self, other)
 |  
 |  __reduce__(self)
 |      helper for pickle
 |  
 |  __setstate__(self, state)
 |  
 |  __str__(self)
 |      Return str(self).
 |  
 |  __sub__(self, other)
 |  
 |  __xor__(self, other)
 |  
 |  almost_equals(self, other, decimal=6)
 |      Returns True if geometries are equal at all coordinates to a
 |      specified decimal place
 |      
 |      Refers to approximate coordinate equality, which requires coordinates be
 |      approximately equal and in the same order for all components of a geometry.
 |  
 |  buffer(self, distance, resolution=16, quadsegs=None, cap_style=1, join_style=1, mitre_limit=5.0)
 |      Returns a geometry with an envelope at a distance from the object's
 |      envelope
 |      
 |      A negative distance has a "shrink" effect. A zero distance may be used
 |      to "tidy" a polygon. The resolution of the buffer around each vertex of
 |      the object increases by increasing the resolution keyword parameter
 |      or second positional parameter. Note: the use of a `quadsegs` parameter
 |      is deprecated and will be gone from the next major release.
 |      
 |      The styles of caps are: CAP_STYLE.round (1), CAP_STYLE.flat (2), and
 |      CAP_STYLE.square (3).
 |      
 |      The styles of joins between offset segments are: JOIN_STYLE.round (1),
 |      JOIN_STYLE.mitre (2), and JOIN_STYLE.bevel (3).
 |      
 |      The mitre limit ratio is used for very sharp corners. The mitre ratio
 |      is the ratio of the distance from the corner to the end of the mitred
 |      offset corner. When two line segments meet at a sharp angle, a miter
 |      join will extend the original geometry. To prevent unreasonable
 |      geometry, the mitre limit allows controlling the maximum length of the
 |      join corner. Corners with a ratio which exceed the limit will be
 |      beveled.
 |      
 |      Example:
 |      
 |        >>> from shapely.wkt import loads
 |        >>> g = loads('POINT (0.0 0.0)')
 |        >>> g.buffer(1.0).area        # 16-gon approx of a unit radius circle
 |        3.1365484905459389
 |        >>> g.buffer(1.0, 128).area   # 128-gon approximation
 |        3.1415138011443009
 |        >>> g.buffer(1.0, 3).area     # triangle approximation
 |        3.0
 |        >>> list(g.buffer(1.0, cap_style='square').exterior.coords)
 |        [(1.0, 1.0), (1.0, -1.0), (-1.0, -1.0), (-1.0, 1.0), (1.0, 1.0)]
 |        >>> g.buffer(1.0, cap_style='square').area
 |        4.0
 |  
 |  contains(self, other)
 |      Returns True if the geometry contains the other, else False
 |  
 |  covers(self, other)
 |      Returns True if the geometry covers the other, else False
 |  
 |  crosses(self, other)
 |      Returns True if the geometries cross, else False
 |  
 |  difference(self, other)
 |      Returns the difference of the geometries
 |  
 |  disjoint(self, other)
 |      Returns True if geometries are disjoint, else False
 |  
 |  distance(self, other)
 |      Unitless distance to other geometry (float)
 |  
 |  empty(self, val=140461818210512)
 |  
 |  equals(self, other)
 |      Returns True if geometries are equal, else False
 |      
 |      Refers to point-set equality (or topological equality), and is equivalent to
 |      (self.within(other) & self.contains(other))
 |  
 |  equals_exact(self, other, tolerance)
 |      Returns True if geometries are equal to within a specified
 |      tolerance
 |      
 |      Refers to coordinate equality, which requires coordinates to be equal 
 |      and in the same order for all components of a geometry
 |  
 |  geometryType(self)
 |  
 |  hausdorff_distance(self, other)
 |      Unitless hausdorff distance to other geometry (float)
 |  
 |  interpolate(self, distance, normalized=False)
 |      Return a point at the specified distance along a linear geometry
 |      
 |      If the normalized arg is True, the distance will be interpreted as a
 |      fraction of the geometry's length.
 |  
 |  intersection(self, other)
 |      Returns the intersection of the geometries
 |  
 |  intersects(self, other)
 |      Returns True if geometries intersect, else False
 |  
 |  overlaps(self, other)
 |      Returns True if geometries overlap, else False
 |  
 |  project(self, other, normalized=False)
 |      Returns the distance along this geometry to a point nearest the
 |      specified point
 |      
 |      If the normalized arg is True, return the distance normalized to the
 |      length of the linear geometry.
 |  
 |  relate(self, other)
 |      Returns the DE-9IM intersection matrix for the two geometries
 |      (string)
 |  
 |  relate_pattern(self, other, pattern)
 |      Returns True if the DE-9IM string code for the relationship between
 |      the geometries satisfies the pattern, else False
 |  
 |  representative_point(self)
 |      Returns a point guaranteed to be within the object, cheaply.
 |  
 |  simplify(self, tolerance, preserve_topology=True)
 |      Returns a simplified geometry produced by the Douglas-Peucker
 |      algorithm
 |      
 |      Coordinates of the simplified geometry will be no more than the
 |      tolerance distance from the original. Unless the topology preserving
 |      option is used, the algorithm may produce self-intersecting or
 |      otherwise invalid geometries.
 |  
 |  symmetric_difference(self, other)
 |      Returns the symmetric difference of the geometries
 |      (Shapely geometry)
 |  
 |  to_wkb(self)
 |  
 |  to_wkt(self)
 |  
 |  touches(self, other)
 |      Returns True if geometries touch, else False
 |  
 |  union(self, other)
 |      Returns the union of the geometries (Shapely geometry)
 |  
 |  within(self, other)
 |      Returns True if geometry is within the other, else False
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from shapely.geometry.base.BaseGeometry:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  area
 |      Unitless area of the geometry (float)
 |  
 |  array_interface_base
 |  
 |  boundary
 |      Returns a lower dimension geometry that bounds the object
 |      
 |      The boundary of a polygon is a line, the boundary of a line is a
 |      collection of points. The boundary of a point is an empty (null)
 |      collection.
 |  
 |  bounds
 |      Returns minimum bounding region (minx, miny, maxx, maxy)
 |  
 |  centroid
 |      Returns the geometric center of the object
 |  
 |  convex_hull
 |      Imagine an elastic band stretched around the geometry: that's a
 |      convex hull, more or less
 |      
 |      The convex hull of a three member multipoint, for example, is a
 |      triangular polygon.
 |  
 |  envelope
 |      A figure that envelopes the geometry
 |  
 |  geom_type
 |      Name of the geometry's type, such as 'Point'
 |  
 |  has_z
 |      True if the geometry's coordinate sequence(s) have z values (are
 |      3-dimensional)
 |  
 |  is_closed
 |      True if the geometry is closed, else False
 |      
 |      Applicable only to 1-D geometries.
 |  
 |  is_empty
 |      True if the set of points in this geometry is empty, else False
 |  
 |  is_ring
 |      True if the geometry is a closed ring, else False
 |  
 |  is_simple
 |      True if the geometry is simple, meaning that any self-intersections
 |      are only at boundary points, else False
 |  
 |  is_valid
 |      True if the geometry is valid (definition depends on sub-class),
 |      else False
 |  
 |  length
 |      Unitless length of the geometry (float)
 |  
 |  minimum_rotated_rectangle
 |      Returns the general minimum bounding rectangle of
 |      the geometry. Can possibly be rotated. If the convex hull
 |      of the object is a degenerate (line or point) this same degenerate
 |      is returned.
 |  
 |  type
 |  
 |  wkb
 |      WKB representation of the geometry
 |  
 |  wkb_hex
 |      WKB hex representation of the geometry
 |  
 |  wkt
 |      WKT representation of the geometry
 |  
 |  xy
 |      Separate arrays of X and Y coordinate values
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from shapely.geometry.base.BaseGeometry:
 |  
 |  __geom__ = 140461818210512
 |  
 |  __p__ = None
 |  
 |  impl = <GEOSImpl object: GEOS C API version (1, 8, 0)>

Look at this line on a map:


In [16]:
%matplotlib notebook
import matplotlib.pyplot as plt

plt.figure()
ax = plt.axes(projection=pc)
ax.add_geometries(
    [lines], pc,
    edgecolor='blue', facecolor='none', lw=2)
ax.coastlines()
plt.show()



In [15]:
# Will this work on E2N? No:  I think it's because original line coords are in lat/lon?
#e2n_lines = e2n.project_geometry(line, e2n)

#plt.figure()
#ax = plt.axes(projection=e2n)
#ax.add_geometries(
#    [e2n_lines], e2n,
#    edgecolor='blue', facecolor='none', lw=2)
#ax.coastlines()
#plt.show()

Using cartopy's io shapefile interface to read Hunza basin shapefile


In [17]:
import cartopy.crs as ccrs
import cartopy.io.shapereader as shpreader
import shapely.geometry as sgeom

bfile = '/Users/brodzik/Desktop/GIS_data/basins/IN_Hunza_at_DainyorBridge.shp'

In [18]:
reader = shpreader.Reader(bfile)
record = next(reader.records())

In [19]:
record


Out[19]:
<Record: <shapely.geometry.multipolygon.MultiPolygon object at 0x1190b3ac8>, {'GRDC_NO': 2335100, 'WMO_REG': 2, 'SUB_REG': 35, 'MIX_REG': 235, 'NAT_ID': '1001', 'RIVER': 'HUNZA RIVER', 'STATION': 'DANYOUR BRIDGE', 'COUNTRY_CO': 'PK', 'LAT_ORG': 35.92, 'LONG_ORG': 74.38, 'LAT_NEW': 35.9271, 'LONG_NEW': 74.3729, 'DIST_KM': 1.0, 'AREA': 12950.0, 'AREA_HYS': 13746.4, 'AREA_DIFF': 6.1, 'ALTITUDE': -999.0, 'ELEV_HYS': 1446, 'DS_STAT_NO': 2335200, 'W_LEVEL': 0, 'D_START': 1978, 'D_END': 1982, 'D_YRS': 5, 'D_MISS': 20, 'M_START': 1978, 'M_END': 1982, 'M_YRS': 5, 'M_MISS': 20, 'T_START': 1978, 'T_END': 1982, 'T_YRS': 5, 'LTA_DISCHA': 381.128, 'DISC_HYS': 55.74, 'DISC_DIFF': -85.4, 'R_VOLUME_Y': 12, 'R_HEIGHT_Y': 928, 'PROC_TYRS': 80, 'PROC_TMON': 100, 'F_IMPORT': '16.1.1992', 'F_IM_YR': 1992, 'L_IMPORT': '10.5.1996', 'L_IM_YR': 1996, 'PROVIDER_I': -999, 'ACSYS': 0, 'FLUX2OCEAN': 0, 'GEMS': 0, 'GCOS_GTN_H': 0, 'STATISTICS': 0, 'CODE': 2, 'QUALITY': 'Medium', 'TYPE': 'Automatic', 'COMMENT': 'Area difference 5-10% and distance <= 5 km', 'HS_REGION': 'As'}, <fields>>

In [20]:
record.attributes


Out[20]:
{'GRDC_NO': 2335100,
 'WMO_REG': 2,
 'SUB_REG': 35,
 'MIX_REG': 235,
 'NAT_ID': '1001',
 'RIVER': 'HUNZA RIVER',
 'STATION': 'DANYOUR BRIDGE',
 'COUNTRY_CO': 'PK',
 'LAT_ORG': 35.92,
 'LONG_ORG': 74.38,
 'LAT_NEW': 35.9271,
 'LONG_NEW': 74.3729,
 'DIST_KM': 1.0,
 'AREA': 12950.0,
 'AREA_HYS': 13746.4,
 'AREA_DIFF': 6.1,
 'ALTITUDE': -999.0,
 'ELEV_HYS': 1446,
 'DS_STAT_NO': 2335200,
 'W_LEVEL': 0,
 'D_START': 1978,
 'D_END': 1982,
 'D_YRS': 5,
 'D_MISS': 20,
 'M_START': 1978,
 'M_END': 1982,
 'M_YRS': 5,
 'M_MISS': 20,
 'T_START': 1978,
 'T_END': 1982,
 'T_YRS': 5,
 'LTA_DISCHA': 381.128,
 'DISC_HYS': 55.74,
 'DISC_DIFF': -85.4,
 'R_VOLUME_Y': 12,
 'R_HEIGHT_Y': 928,
 'PROC_TYRS': 80,
 'PROC_TMON': 100,
 'F_IMPORT': '16.1.1992',
 'F_IM_YR': 1992,
 'L_IMPORT': '10.5.1996',
 'L_IM_YR': 1996,
 'PROVIDER_I': -999,
 'ACSYS': 0,
 'FLUX2OCEAN': 0,
 'GEMS': 0,
 'GCOS_GTN_H': 0,
 'STATISTICS': 0,
 'CODE': 2,
 'QUALITY': 'Medium',
 'TYPE': 'Automatic',
 'COMMENT': 'Area difference 5-10% and distance <= 5 km',
 'HS_REGION': 'As'}

In [21]:
record.bounds


Out[21]:
(74.02507731119763, 35.92307128906174, 75.77779744466116, 37.09783732096277)

In [22]:
record.geometry


Out[22]:

In [23]:
help(record)


Help on Record in module cartopy.io.shapereader object:

class Record(builtins.object)
 |  A single logical entry from a shapefile, combining the attributes with
 |  their associated geometry.
 |  
 |  Methods defined here:
 |  
 |  __init__(self, shape, geometry_factory, attributes, fields)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |  
 |  __repr__(self)
 |      Return repr(self).
 |  
 |  __str__(self)
 |      Return str(self).
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  bounds
 |      The bounds of this Record's :meth:`~Record.geometry`.
 |  
 |  geometry
 |      A shapely.geometry instance for this Record.
 |      
 |      The geometry may be ``None`` if a null shape is defined in the
 |      shapefile.


In [46]:
e2n = ccrs.LambertAzimuthalEqualArea(central_latitude=90.)
e2n_basin = e2n.project_geometry(record.geometry)

In [45]:
plt.figure()

ax = plt.axes(projection=e2n)
ax.set_extent([0., 9000000., -9000000., 0.], crs=e2n)
ax.gridlines(color='gray', linestyle='--')
ax.coastlines()

ax.add_geometries(
    [e2n_basin], e2n,
    edgecolors='red', facecolor='none', lw=2)


plt.tight_layout()
plt.show()



In [47]:
from netCDF4 import Dataset

In [49]:
cetbfile = '/Users/brodzik/cetb_data/v1.3/AQUA_AMSRE/2004164/NSIDC-0630-EASE2_N3.125km-AQUA_AMSRE-2004164-36H-M-SIR-RSS-v1.3.nc'
f = Dataset(cetbfile, 'r', 'netCDF4')
f


Out[49]:
<class 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
    Conventions: CF-1.6, ACDD-1.3
    title: MEaSUREs Calibrated Passive Microwave Daily EASE-Grid 2.0 Brightness Temperature ESDR
    product_version: v1.3
    software_version_id: 0.3.15
    software_repository: git@bitbucket.org:nsidc/measures-byu.git
    history: meas_meta_sir
    comment: Epoch date for data in this file: 2004-06-12 00:00:00Z
    source: 10.5067/AMSR-E/AMSREL1A.003
10.5067/AMSR-E/AE_L2A.003
    references: Long, D. G. and M. J. Brodzik. 2016. Optimum Image Formation for Spaceborne Microwave Radiometer Products. IEEE Trans. Geosci. Remote Sensing, 54(5):2763-2779, doi:10.1109/TGRS.2015.2505677.
Algorithm Theoretical Basis Document:  https://nsidc.org/sites/nsidc.org/files/technical-references/MEaSUREs_CETB_ATBD.pdf

    metadata_link: http://nsidc.org/data/nsidc-0630.html
    summary: An improved, enhanced-resolution, gridded passive microwave Earth System Data Record for monitoring cryospheric and hydrologic time series

    institution: National Snow and Ice Data Center
Cooperative Institute for Research in Environmental Sciences
University of Colorado at Boulder
Boulder, CO
    publisher_name: NASA National Snow and Ice Data Center Distributed Active Archive Center
    publisher_type: institution
    publisher_url: http://nsidc.org
    publisher_email: nsidc@nsidc.org
    program: NASA 2012 MEaSUREs (Making Earth System Data Records for Use in Research Environments)
    project: An improved, enhanced-resolution, gridded passive microwave ESDR for monitoring cryospheric and hydrologic time series
    standard_name_vocabulary: CF Standard Name Table (v27, 28 September 2013)
    cdm_data_type: Grid
    keywords: EARTH SCIENCE > SPECTRAL/ENGINEERING > MICROWAVE > BRIGHTNESS TEMPERATURE
    keywords_vocabulary: NASA Global Change Master Directory (GCMD) Earth Science Keywords, Version 8.1
    platform: AQUA > Earth Observing System, AQUA
    platform_vocabulary: NASA Global Change Master Directory (GCMD) Earth Science Keywords, Version 8.1
    instrument: AMSR-E > Advanced Microwave Scanning Radiometer-EOS
    instrument_vocabulary: NASA Global Change Master Directory (GCMD) Earth Science Keywords, Version 8.1
    time_coverage_resolution: P1d
    geospatial_lat_units: degree_north
    geospatial_lon_units: degree_east
    geospatial_x_units: meters
    geospatial_y_units: meters
    naming_authority: org.doi.dx
    id: 10.5067/MEASURES/CRYOSPHERE/nsidc-0630.001
    date_created: 2018-03-23T05:31:12MDT
    date_modified: 2018-03-23T05:31:12MDT
    date_issued: 2018-03-23T05:31:12MDT
    date_metadata_modified: 2018-03-23T05:31:12MDT
    acknowledgement: This data set was created with funding from NASA MEaSUREs Grant #NNX13AI23A.
Data archiving and distribution is supported by the NASA NSIDC Distributed Active Archive Center (DAAC).
    license: No constraints on data access or use
    processing_level: Level 3
    creator_name: Mary J. Brodzik
    creator_type: person
    creator_email: brodzik@nsidc.org
    creator_url: http://nsidc.org/pmesdr
    creator_institution: National Snow and Ice Data Center
Cooperative Institute for Research in Environmental Sciences
University of Colorado at Boulder
Boulder, CO
    contributor_name: Mary J. Brodzik, David G. Long, Richard L. Armstrong, Molly A. Hardman, Aaron C. Paget
    contributor_role: Principal Investigator, Co-Investigator, Co-Investigator, Developer, Contributor
    citation: Brodzik, M. J., D. G. Long, M. A. Hardman, A. C. Paget, R. L. Armstrong. 2016, updated 2018.
MEaSUREs Calibrated Passive Microwave Daily EASE-Grid 2.0 Brightness Temperature ESDR.
Version 1.3.
[Indicate subset used].
Boulder, Colorado USA: NASA DAAC at the National Snow and Ice Data Center.
    geospatial_bounds: EPSG:3475
    geospatial_bounds_crs: EPSG:6931
    geospatial_lat_min: 0.0
    geospatial_lat_max: 90.0
    geospatial_lon_min: -180.0
    geospatial_lon_max: 180.0
    geospatial_x_resolution: 3125.00 meters
    geospatial_y_resolution: 3125.00 meters
    time_coverage_start: 2004-06-12T00:05:00.00Z
    time_coverage_end: 2004-06-12T18:12:00.00Z
    time_coverage_duration: P00T18:07:00.00
    number_of_input_files: 18
    input_file1: AMSR_E_L2A_BrightnessTemperatures_V12_200406111410_D.hdf (GSX_version:1.10.1)
    input_file2: AMSR_E_L2A_BrightnessTemperatures_V12_200406111549_D.hdf (GSX_version:1.10.1)
    input_file3: AMSR_E_L2A_BrightnessTemperatures_V12_200406111727_D.hdf (GSX_version:1.10.1)
    input_file4: AMSR_E_L2A_BrightnessTemperatures_V12_200406111906_D.hdf (GSX_version:1.10.1)
    input_file5: AMSR_E_L2A_BrightnessTemperatures_V12_200406112045_D.hdf (GSX_version:1.10.1)
    input_file6: AMSR_E_L2A_BrightnessTemperatures_V12_200406112224_D.hdf (GSX_version:1.10.1)
    input_file7: AMSR_E_L2A_BrightnessTemperatures_V12_200406120003_D.hdf (GSX_version:1.10.1)
    input_file8: AMSR_E_L2A_BrightnessTemperatures_V12_200406120142_D.hdf (GSX_version:1.10.1)
    input_file9: AMSR_E_L2A_BrightnessTemperatures_V12_200406120321_D.hdf (GSX_version:1.10.1)
    input_file10: AMSR_E_L2A_BrightnessTemperatures_V12_200406120500_D.hdf (GSX_version:1.10.1)
    input_file11: AMSR_E_L2A_BrightnessTemperatures_V12_200406120639_D.hdf (GSX_version:1.10.1)
    input_file12: AMSR_E_L2A_BrightnessTemperatures_V12_200406120817_D.hdf (GSX_version:1.10.1)
    input_file13: AMSR_E_L2A_BrightnessTemperatures_V12_200406120956_D.hdf (GSX_version:1.10.1)
    input_file14: AMSR_E_L2A_BrightnessTemperatures_V12_200406121135_D.hdf (GSX_version:1.10.1)
    input_file15: AMSR_E_L2A_BrightnessTemperatures_V12_200406121314_D.hdf (GSX_version:1.10.1)
    input_file16: AMSR_E_L2A_BrightnessTemperatures_V12_200406121453_D.hdf (GSX_version:1.10.1)
    input_file17: AMSR_E_L2A_BrightnessTemperatures_V12_200406121632_D.hdf (GSX_version:1.10.1)
    input_file18: AMSR_E_L2A_BrightnessTemperatures_V12_200406121811_D.hdf (GSX_version:1.10.1)
    dimensions(sizes): time(1), y(5760), x(5760)
    variables(dimensions): float64 time(time), float64 y(y), float64 x(x), |S1 crs(), uint16 TB(time,y,x), uint8 TB_num_samples(time,y,x), int16 Incidence_angle(time,y,x), uint16 TB_std_dev(time,y,x), int16 TB_time(time,y,x)
    groups: 

In [55]:
import numpy as np
tb = np.squeeze(f.variables['TB'][:])
tb.shape


Out[55]:
(5760, 5760)

In [58]:
plt.figure()

ax = plt.axes(projection=e2n)
ax.set_extent([-9000000., 9000000., -9000000., 9000000.], crs=e2n)
ax.gridlines(color='gray', linestyle='--')
ax.coastlines()

# ax.imshow(tb, transform=e2n)

#ax.add_geometries(
#    [e2n_basin], e2n,
#    edgecolors='red', facecolor='none', lw=2)


plt.tight_layout()
plt.show()

#ax.imshow(tb, extent=extent, transform=rob, origin='upper')



In [ ]: