This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
import warnings | |
def mostcommon_utm(dc, product, query): | |
''' | |
Takes a given query and returns the most common UTM zone for | |
observations returned for that spatial extent. | |
Parameters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!gdalbuildvrt /g/data/r78/rt1527/nidem/output_data/mosaics/NIDEM_uncertainty.vrt ../output_data/geotiff/nidem_uncertainty/NIDEM_uncertainty*.tif | |
!gdal_translate \ | |
-co COMPRESS=DEFLATE \ | |
-co ZLEVEL=9 \ | |
-co PREDICTOR=1 \ | |
-co TILED=YES \ | |
-co BLOCKXSIZE=1024 \ | |
-co BLOCKYSIZE=1024 \ | |
/g/data/r78/rt1527/nidem/output_data/mosaics/NIDEM.vrt /g/data/r78/rt1527/nidem/output_data/mosaics/NIDEM_mosaic.tif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datacube.testutils.io import rio_slurp | |
from datacube.storage import measurement_paths | |
ds = dc.find_datasets(product='ls8_nbar_scene')[0] | |
band_path = measurement_paths(ds)['3'] | |
raster_meta = rio_slurp(band_path) | |
raster_meta[1].transform | |
raster_meta[1].crs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Claire Krause | |
# Save the polygons to a shapefile | |
schema = {'geometry': 'Polygon','properties': {'area': 'str'}} | |
if os.path.isfile('test.shp'): | |
with fiona.open('test.shp', "a", crs = from_epsg(3577), driver = 'ESRI Shapefile', schema = schema) as output: | |
for ix, poly in MergedPolygonsGPD.iterrows(): | |
output.write(({'properties': {'area': poly['area']},'geometry': mapping(shape(poly['geometry']))})) | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from otps import TimePoint | |
from otps import predict_tide | |
tidepost_lat, tidepost_lon =-12.213764, 131.824570 # pointstuart | |
tidepost_lat, tidepost_lon =-13.315045, 130.234212 # dalyriver | |
tidepost_lat, tidepost_lon =-14.957638244600385, 129.5448589323929 # josephbonapartegulf | |
# Use the OTPS tidal mode to compute tide heights for each observation: | |
date_range = pd.date_range("2013-01-01", "2019-05-05", freq="1h") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datacube | |
from datacube.utils import geometry | |
from datacube.utils.geometry import CRS | |
# Connect to datacube | |
dc = datacube.Datacube(app='Simple example') | |
# Set up analysis data query | |
query = { | |
'x': (1754576.964742866, 1762576.964742866), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Imam Alam | |
# imports | |
import numpy as np | |
import pandas as pd | |
import xarray as xr | |
# define an example volume, roughly MGA xy, + elevation | |
x = range(50000, 52000, 100) | |
y = range(800000, 802000, 100) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imageio | |
import numpy as np | |
from_array = imageio.imread('Visualisation/pilbara/pilbara_before.png') | |
to_array = imageio.imread('Visualisation/pilbara/pilbara_after.png') | |
stacked_from_to = np.stack([to_array, from_array], axis=3) | |
weights = [0.2, 0.4, 0.6, 0.8, 1.0, 0.8, 0.6, 0.4, 0.2, 0] | |
milliseconds = [50, 50, 50, 50, 3500, 50, 50, 50, 50, 3500] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
import xarray as xr | |
from datetime import datetime | |
# List all matching files | |
files = glob.glob('/g/data/r78/mc9153/tide_otps/L3_2008_nc3/*.L3m') | |
# Create list for | |
individual_files = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For anyone putting together notebooks that use Collection Upgrade/Collection 3 | |
# Landsat, the product names are: | |
# • ga_ls5t_ard_3 (Landsat 5 ARD) | |
# • ga_ls7e_ard_3 (Landsat 7 ARD) | |
# • ga_ls8c_ard_3 (Landsat 8 ARD) | |
# The Collection 3 samples on the NCI are stored in a different database, so for | |
# now we can use the try/except below to connect to the datacube differently on | |
# both the NCI and the Sandbox (we'll hopefully just be able to connect using |
OlderNewer