Skip to content

Instantly share code, notes, and snippets.

@jcaesar
Last active December 3, 2023 11:33
Show Gist options
  • Save jcaesar/639256daf471c435d5e23a78f2662be4 to your computer and use it in GitHub Desktop.
Save jcaesar/639256daf471c435d5e23a78f2662be4 to your computer and use it in GitHub Desktop.
a
result
*.bsp
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1701336116,
"narHash": "sha256-kEmpezCR/FpITc6yMbAh4WrOCiT2zg5pSjnKrq51h5Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f5c27c6136db4d76c30e533c20517df6864c46ee",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
{
description = "A very basic flake";
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
pyp = pkgs.python311Packages;
in {
packages.x86_64-linux.default = pyp.buildPythonApplication {
name = "skynix";
pyproject = true;
nativeBuildInputs = [ pyp.hatchling ];
propagatedBuildInputs = [ pyp.skyfield ];
src = self;
};
devShells.${system}.default = pkgs.mkShell {
packages = [
(pkgs.python311.withPackages (ps: [ ps.skyfield ]))
];
shellHook = "exec python";
};
};
}
[project]
name = "skynix"
version = "0.1.0"
dependencies = ["skyfield"]
requires-python = ">=3.9"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project.scripts]
skynix = "skynix:main"
#!/usr/bin/env python
import skyfield
from skyfield.api import Topos, load
def main():
ts = load.timescale()
planets = load('de421.bsp')
sun = planets['sun']
earth = planets['earth']
np = earth + Topos('34 N', '139 W')
t = ts.utc(2023, 12, 21, 12 + 9, 15, 0)
print(np.at(t).observe(sun).apparent().altaz())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment