Skip to content

Instantly share code, notes, and snippets.

View prl900's full-sized avatar

Pablo Rozas Larraondo prl900

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import TensorFlow
// Custom differentiable type.
struct LinearRegressor: Differentiable {
var w: Tensor<Float>
var b: Tensor<Float>
func callAsFunction(_ x: Tensor<Float>) -> Tensor<Float> {
return matmul(x, w) + b
}
}
import json
import numpy as np
import matplotlib.pyplot as plt
from pyproj import Proj, transform
wgs84_proj = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs "
au_albers = "+proj=aea +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=132 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "
# Canberra (Australia)
lat = -35.28
lon = 149.13
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
module load gdal/1.9.2
module load cdo
module load nco
YEAR=2017
DATE=$(date -u -d $YEAR"-01-01")
END=$(date -u -d "2018-01-01")
COUNTER=0
module load cdo
module load nco
module load gdal/2.2.2
cdo -b I16 select,name=maxPV /g/data/ub8/au/LandCover/DEA_ALC/17_-25/fc_metrics_17_-25_2014.nc out.nc
ncpdq -a y,x out.nc out_swap.nc
gdal_translate -ot Byte NETCDF:"out_swap.nc":maxPV test.tiff -co TILED=YES -co COMPRESS=DEFLATE
gdaladdo test.tiff 2 4 8 16 32
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
print("Jan")
ds = xr.open_dataset("era5_prec_2018H1.nc")
prec = ds.tp.sel(dict(time=slice('2018-01-01', '2018-01-31'))).data * 1000
ds.close()
print(prec.shape)