This file contains 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 datetime as dt | |
import numpy as np | |
def to_datetime(date: np.datetime64) -> dt.datetime: | |
""" Converts a numpy datetime64 object to a python datetime object """ | |
timestamp = ((date - np.datetime64('1970-01-01T00:00:00')) | |
/ np.timedelta64(1, 's')) | |
return dt.datetime.utcfromtimestamp(timestamp) |
This file contains 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
using PyCall | |
using PyPlot | |
@pyimport cartopy.crs as ccrs | |
plot_proj = ccrs.LambertCylindrical(central_longitude=180) | |
data_proj = ccrs.PlateCarree() | |
lons = collect([i for j in -90:90, i in -180:180]) # Important to collect before passing to PyPlot | |
lats = collect([j for j in -90:90, i in -180:180]) | |
data = sin.((lons .+ lats) ./ 180 .* π) |