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
runtime: python37 | |
service: pycloud-wms |
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
Flask==1.0.2 | |
numpy==1.15.4 | |
numexpr==2.6.9 | |
matplotlib==3.0.2 | |
gdal==2.2.2 | |
google-cloud-storage |
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 google.cloud import storage | |
from glob import glob | |
from os.path import basename, join | |
gsbucket = "nsw_water_compliance" | |
def upload_files(gsbucket, dst_path, src_path, wildcard="*"): | |
storage_client = storage.Client() | |
bucket = storage_client.bucket(gsbucket) | |
file_paths = glob("{}/{}".format(src_path, wildcard)) |
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
package main | |
import ( | |
"fmt" | |
"image" | |
"image/color" | |
"image/png" | |
"os" | |
) |
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 xarray as xr | |
import numpy as np | |
tp = xr.open_dataset("EU_TP_ERAI.nc").tp[:].data.astype(np.float32) | |
print(tp.shape) | |
np.savez("/g/data/fj4/scratch/tp", tp[:, :, :]) | |
z = xr.open_dataset("EU_Z_ERAI.nc").z[:].data.astype(np.float32) | |
print(z.shape) | |
np.savez("/g/data/fj4/scratch/z", z[:, :, :, :]) |
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 tensorflow.keras.models import Sequential | |
from tensorflow.keras.layers import BatchNormalization, Conv2D | |
from tensorflow.keras.optimizers import Adam | |
from tensorflow.keras.callbacks import CSVLogger | |
from matplotlib import pyplot as plt | |
import numpy as np | |
def GetModel(conv1_size): | |
model = Sequential() |
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 pyproj import Proj, transform | |
import math | |
xExtentModis = 1111950.519666 | |
yExtentModis = 1111950.519667 | |
sinu_proj = "+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs " | |
wgs84_proj = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs " | |
def xy2tile(x, y): | |
return int(math.floor(x/xExtentModis)) + 18, -1*int(math.ceil(y/yExtentModis)) + 9 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 numpy as np | |
import xarray as xr | |
# Load ERA5 geopotential levels | |
era5_ds1 = xr.open_dataset("./datasets/GEOP1000_GAN_2017.nc") | |
era5_ds2 = xr.open_dataset("./datasets/GEOP800_GAN_2017.nc") | |
era5_ds3 = xr.open_dataset("./datasets/GEOP500_GAN_2017.nc") | |
era5_times = era5_ds1.time[:].data | |
# Load ERA5 total precipitation |
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.storage import masking | |
import matplotlib.pyplot as plt | |
import numpy as np | |
dc = datacube.Datacube(app='load-data-example') | |
query = { | |
'lat': (-35.27, -35.33), | |
'lon': (149.07, 149.15), |