#NEWLINE# def spatial_resolution( self ) : #NEWLINE# #INDENT# "Calculate the latitudinal and longitudinal spatial resolution.\n\n           If self.lats and self.lons are from curvilinear coordinates, \n           the output resolutions are approximate values.\n        :returns: The Dataset's latitudinal and longitudinal spatial resolution\n            as a tuple of the form (lat_resolution, lon_resolution).\n        :rtype: (:class:`float`, :class:`float`)\n        " #NEWLINE# if ( ( self . lats . ndim == 1 ) and ( self . lons . ndim == 1 ) ) : #NEWLINE# #INDENT# sorted_lats = numpy . sort ( list ( set ( self . lats ) ) ) #NEWLINE# sorted_lons = numpy . sort ( list ( set ( self . lons ) ) ) #NEWLINE# lat_resolution = ( sorted_lats [ 1 ] - sorted_lats [ 0 ] ) #NEWLINE# lon_resolution = ( sorted_lons [ 1 ] - sorted_lons [ 0 ] ) #NEWLINE# #UNINDENT# if ( ( self . lats . ndim == 2 ) and ( self . lons . ndim == 2 ) ) : #NEWLINE# #INDENT# lat_resolution = ( self . lats [ ( 1 , 1 ) ] - self . lats [ ( 0 , 0 ) ] ) #NEWLINE# lon_resolution = ( self . lons [ ( 1 , 1 ) ] - self . lons [ ( 0 , 0 ) ] ) #NEWLINE# #UNINDENT# return ( self , lon_resolution )