Get the area extent of the file.
492092
def get_area_extent(self, size, offsets, factors, platform_height):
        """"""
        nlines, ncols = size
        h = platform_height

        # count starts at 1
        cols = 1 - 0.5
        lines = 1 - 0.5
        ll_x, ll_y = self.get_xy_from_linecol(lines, cols, offsets, factors)

        cols += ncols
        lines += nlines
        ur_x, ur_y = self.get_xy_from_linecol(lines, cols, offsets, factors)

        return (np.deg2rad(ll_x) * h, np.deg2rad(ll_y) * h,
                np.deg2rad(ur_x) * h, np.deg2rad(ur_y) * h)
634952
def file_size(self):
        """"""
        if self._file_size is None:
            if isinstance(self._path_or_fd, string_types()):
                self._file_size = os.stat(self._path_or_fd).st_size
            else:
                self._file_size = os.fstat(self._path_or_fd).st_size
            # END handle path type
        # END update file size
        return self._file_size
112817
def Read(self, length):
    """"""
    result = b""

    # The total available size in the file
    length = int(length)
    length = min(length, self.size - self.offset)

    while length > 0:
      data = self._ReadPartial(length)
      if not data:
        break

      length -= len(data)
      result += data
    return result
305236
def area(self):
        """"""
        area = self.parse['attributes'].get('Shape_Area')
        if area:
            return round(float(area) * 10.76391)
1209996
def get_geotiff_area_def(filename, crs):
    """"""
    from osgeo import gdal
    from pyresample.geometry import AreaDefinition
    from pyresample.utils import proj4_str_to_dict
    fid = gdal.Open(filename)
    geo_transform = fid.GetGeoTransform()
    pcs_id = fid.GetProjection().split('"')[1]
    min_x = geo_transform[0]
    max_y = geo_transform[3]
    x_size = fid.RasterXSize
    y_size = fid.RasterYSize
    max_x = min_x + geo_transform[1] * x_size
    min_y = max_y + geo_transform[5] * y_size
    area_extent = [min_x, min_y, max_x, max_y]
    area_def = AreaDefinition('geotiff_area', pcs_id, pcs_id,
                              proj4_str_to_dict(crs),
                              x_size, y_size, area_extent)
    return area_def
1009305
def _file_size(file_path, uncompressed=False):
    """"""
    _, ext = os.path.splitext(file_path)

    if uncompressed:
        if ext in {".gz", ".gzip"}:
            with gzip.GzipFile(file_path, mode="rb") as fp:
                try:
                    fp.seek(0, os.SEEK_END)
                    return fp.tell()
                except ValueError:
                    # on python2, cannot seek from end and must instead read to end
                    fp.seek(0)
                    while len(fp.read(8192)) != 0:
                        pass
                    return fp.tell()
        elif ext in {".bz", ".bz2", ".bzip", ".bzip2"}:
            with bz2.BZ2File(file_path, mode="rb") as fp:
                fp.seek(0, os.SEEK_END)
                return fp.tell()

    return os.path.getsize(file_path)
149783
public static String getExtension(String fileName) {
        int dotIndex = fileName.lastIndexOf(DOT);
        return dotIndex > 0 ? fileName.substring(dotIndex) : EMPTY;
    }
101519
def file_size(self):
        
        stream = self.get_file_stream()
        stream.seek(0, os.SEEK_END)
        return stream.tell()
275696
private static String getFileExtension(Resource file) {
	String name = file.getName();
	int index = name.lastIndexOf('.');
	if (index == -1) return null;
	return name.substring(index + 1).trim();
    }
295348
def number_of_extents(self):
    """"""
    if not self._is_parsed:
      self._Parse()
      self._is_parsed = True

    return len(self._extents)
18779
def get_area_def(self, key, info=None):
        
        # TODO Get projection information from input file
        a = 6378169.
        h = 35785831.
        b = 6356583.8
        lon_0 = 0.
        # area_extent = (-5432229.9317116784, -5429229.5285458621,
        #                5429229.5285458621, 5432229.9317116784)
        area_extent = (-5570248.4773392612, -5567248.074173444,
                       5567248.074173444, 5570248.4773392612)
        proj_dict = {'a': float(a),
                     'b': float(b),
                     'lon_0': float(lon_0),
                     'h': float(h),
                     'proj': 'geos',
                     'units': 'm'}

        area = geometry.AreaDefinition(
            'LI_area_name',
            "LI area",
            'geosli',
            proj_dict,
            self.ncols,
            self.nlines,
            area_extent)
        self.area = area
        logger.debug("Dataset area definition: \n {}".format(area))
        return area
8616
def get_size(self):
    
    if not self._is_open:
      raise IOError('Not opened.')

    if not hasattr(self._file_object, 'get_size'):
      if not self._size:
        current_offset = self.get_offset()
        self.seek(0, os.SEEK_END)
        self._size = self.get_offset()
        self.seek(current_offset, os.SEEK_SET)
      return self._size

    return self._file_object.get_size()
1223719
protected function get_module_areas_with_files($extensions = '*') {
        global $DB;

        $params1 = ['contextid' => $this->context->id,
            'emptyfilename' => '.',
            'contextlevel' => CONTEXT_MODULE,
            'course' => $this->course->id];
        $ctxfieldsas = context_helper::get_preload_record_columns_sql('ctx');
        $ctxfields = implode(', ', array_keys(context_helper::get_preload_record_columns('ctx')));
        $sql1 = "SELECT
                    ctx.id AS contextid,
                    f.component,
                    f.filearea,
                    f.itemid,
                    ctx.instanceid AS cmid,
                    {$ctxfieldsas}
            FROM {files} f
            INNER JOIN {context} ctx ON ctx.id = f.contextid
            INNER JOIN {course_modules} cm ON cm.id = ctx.instanceid
            WHERE f.filename <> :emptyfilename
              AND cm.course = :course
              AND ctx.contextlevel = :contextlevel";
        $sql3 = "
            GROUP BY ctx.id, f.component, f.filearea, f.itemid, {$ctxfields}
            ORDER BY ctx.id, f.component, f.filearea, f.itemid";
        list($sql2, $params2) = $this->build_search_files_sql($extensions);
        $areas = [];
        if ($rs = $DB->get_recordset_sql($sql1. $sql2 . $sql3, array_merge($params1, $params2))) {
            foreach ($rs as $record) {
                context_helper::preload_from_record($record);
                $areas[] = $record;
            }
            $rs->close();
        }

        // Sort areas so 'backup' and 'intro' are in the beginning of the list, they are the easiest to check access to.
        usort($areas, function($a, $b) {
            $aeasy = ($a->filearea === 'intro' && substr($a->component, 0, 4) === 'mod_') ||
                ($a->filearea === 'activity' && $a->component === 'backup');
            $beasy = ($b->filearea === 'intro' && substr($b->component, 0, 4) === 'mod_') ||
                ($b->filearea === 'activity' && $b->component === 'backup');
            return $aeasy == $beasy ? 0 : ($aeasy ? -1 : 1);
        });
        return $areas;
    }
620700
public double getTotalArea() {
		double area = 0;
		for (StructureInterface interf:members) {
			area+=interf.getTotalArea();
		}
		return area/members.size();
	}
179535
function getFileExtension(file) {
    return file.name.substring(file.name.lastIndexOf('.')+1, file.name.length).toLowerCase()
}
653265
def read(self, fileobj):
        """"""

        fileobj.seek(self._dataoffset, 0)
        data = fileobj.read(self.datalength)
        return len(data) == self.datalength, data
460366
def filesize(fileobj):
    
    current = fileobj.tell()
    fileobj.seek(0, 2)
    end = fileobj.tell()
    fileobj.seek(current)
    return end