큰 geotif 파일 열기 (Open large geotif file)


문제 설명

큰 geotif 파일 열기 (Open large geotif file)

매우 큰 geotif 파일이 있습니다. 하지만 colabs에서는 열 수 없습니다. RAM이 충분하지 않습니다. 그래서 내가 실행할 때마다 충돌이 시작되었습니다. 이 일을 도와줄 사람이 있습니까?

import numpy as np
from rasterio.plot import show
import os
import matplotlib.pyplot as plt
%matplotlib inline

Data dir

data_dir = "data"

Filepath

fp = os.path.join(data_dir, "/content/drive/MyDrive/LINEasia/test2.tif")

Open the raster file in read mode

raster = rasterio.open(fp)

Read NIR channel (channel number 4)

nir = raster.read(1)

Calculate some stats to check the data

print(red.mean())

print(nir.mean())
print(type(nir))

Visualize

show(nir, cmap='terrain')
}```

uncompressed file size around 3GB.
</code></pre>


참조 솔루션

방법 1:

You can work on smaller portions more like windows. Below code reads 400x400 window from (0, 0) point.

with rasterio.open('/content/drive/MyDrive/LINEasia/test2.tif') as f:
    w = f.read(1, window=Window(0, 0, 400, 400))

(by supun nayakeBaran Bursalı)

참조 문서

  1. Open large geotif file (CC BY‑SA 2.5/3.0/4.0)

#geopandas #Python #raster #ram #geotiff






관련 질문

{'northeast': {'lat':}, 'southwest': {'lat': }}(Google 지도) Python에서 다각형을 만드는 방법 (How to create Polygon out of {'northeast': {'lat':}, 'southwest': {'lat': }} (google maps) Python)

모양이 교차하는 다각형의 수를 어떻게 계산합니까? (How can I count the number of polygons a shape intersects?)

GeoPandas를 사용하여 Python에서 GRASS 벡터 데이터 소스 읽기 (Read GRASS vector datasources in Python using GeoPandas)

어떤 점에 포함된 영역을 찾는 Geopandas (Geopandas to locate which area does a point contains)

Geopandas Dataframe이 인덱스 오류를 반환하는 이유 (Why is the Geopandas Dataframe returning an Index Error)

여러 선스트링으로 구성된 shapefile을 분할하는 방법 (How to split a shapefile compose of multiple linestrings)

LineString 유형의 개체는 JSON 직렬화가 불가능합니다. (Object of type LineString is not JSON serializable)

큰 geotif 파일 열기 (Open large geotif file)

점이 있는 geopandas 데이터 프레임에서 다각형 만들기 (Creating a polygon from a geopandas dataframe with points)

여러 소스 및 대상 노드에 대한 Networkx 최단 경로 분석 (Networkx Shortest Path Analysis on multiple source and target nodes)

위도/경도 포인트가 다각형 내에 있는지 어떻게 확인합니까? (How do I determine if a lat/long point is within a polygon?)

Geodataframe.explore() 오류: __init__() 누락된 1개의 필수 위치 인수: '위치' (Geodataframe.explore() error: __init__() missing 1 required positional argument: 'location')







코멘트