{"id":37183050,"url":"https://github.com/nonnontrivial/ctts","last_synced_at":"2026-01-14T21:08:23.139Z","repository":{"id":216391658,"uuid":"731373817","full_name":"nonnontrivial/ctts","owner":"nonnontrivial","description":"read sky brightness without a sensor","archived":false,"fork":false,"pushed_at":"2025-05-02T01:10:05.000Z","size":60152,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-27T15:11:34.711Z","etag":null,"topics":["astropy","h3","openmeteo","python","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nonnontrivial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-12-14T00:05:45.000Z","updated_at":"2025-05-02T01:10:09.000Z","dependencies_parsed_at":"2024-01-11T03:55:31.707Z","dependency_job_id":"7a58fba7-f7f7-4e10-8e47-f5cd48244933","html_url":"https://github.com/nonnontrivial/ctts","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"d6f667475a5f8982e4de79334c62ecd8cfb74e70"},"previous_names":["nonnontrivial/ctts"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/nonnontrivial/ctts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonnontrivial%2Fctts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonnontrivial%2Fctts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonnontrivial%2Fctts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonnontrivial%2Fctts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nonnontrivial","download_url":"https://codeload.github.com/nonnontrivial/ctts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonnontrivial%2Fctts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434565,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astropy","h3","openmeteo","python","pytorch"],"created_at":"2026-01-14T21:08:22.249Z","updated_at":"2026-01-14T21:08:23.134Z","avatar_url":"https://github.com/nonnontrivial.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CTTS\n\nCTTS is an open source application for reading [sky brightness](https://en.wikipedia.org/wiki/Sky_brightness) without a sensor.\n\nIt works by using a model trained on [GaN](https://globeatnight.org/maps-data/) data to do inference of sky brightness in terms of [H3 cells](https://h3geo.org).\n\n## features\n\n- api server for sky brightness at given H3 cells\n- continuous \"snapshots\" of sky brightness over H3 cells in geojson\n\n## run\n\n1. clone the repo\n2. run the containers:\n\n```sh\ndocker compose up -d\n```\n\n3. add geojson data using the REST endpoint:\n\n```sh\n# n.b. assumes you have already created `data.geojson`; you can create it using a tool like https://geojson.io/\ncurl -X POST -H \"Content-Type: application/json\" -d @data.geojson localhost:8000/geojson\n```\n\n4. logs should then begin to look like:\n\n```log\nsnapshot-1   | 2025-03-22 23:37:54,313 - INFO - requesting inference for 49 cells\napi-1        |       INFO   172.18.0.5:41008 - \"POST /infer HTTP/1.1\" 200\nsnapshot-1   | 2025-03-22 23:37:57,265 - INFO - HTTP Request: POST http://api/infer \"HTTP/1.1 200 OK\"\nsnapshot-1   | 2025-03-22 23:37:57,268 - INFO - published data for 49 cells to brightness.snapshot\n```\n\n5. hook into this data by running one of the consumer scripts in `./consumers/`:\n\n```sh\n# n.b. this script will store the snapshots in a new table in the existing sqlite db, and create folium maps showing the brightness at each cell\nuv run store_in_sqlite.py\n\n```\n\n## message format\n\nThe messages coming over the `brightness.snapshot` queue are JSON objects with the following structure:\n\n```json\n{\n  \"generated_in\": 50.59500000399453,\n  \"completed_at\": \"2025-03-20 12:37:51.516\",\n  \"units\": {\n    \"inferred_brightnesses\": \"mpsas\",\n    \"generated_in\": \"ms\"\n  },\n  \"inferred_brightnesses\": {\n    \"8928308280fffff\": 18.303659439086914\n  },\n  \"is_night\": true\n}\n```\n\n### configuration\n\n#### resolution\n\nTo adjust the H3 resolution that is used to fill the geojson geometry, edit the `RESOLUTION` env var in\nthe snapshot container in `./docker-compose.yml` file.\n\n## REST api\n\n### `POST /infer`\n\n```sh\ncurl -X POST -H \"Content-Type: application/json\" -d '[\"8928308280fffff\"]' localhost:8000/infer\n```\n\n```json\n{\n  \"generated_in\": 53.8709999968745,\n  \"completed_at\": \"2025-03-24 23:43:28.575\",\n  \"units\": {\n    \"inferred_brightnesses\": \"mpsas\",\n    \"generated_in\": \"ms\"\n  },\n  \"inferred_brightnesses\": {\n    \"8928308280fffff\": 11.824697494506836\n  },\n  \"is_night\": false\n}\n```\n\n### `POST /geojson`\n\n\u003e n.b. the geojson stored in the db is what the `snapshot` container uses to\n\u003e make brightness requests\n\nAdd a geojson object to the db.\n\n```sh\n# where `data.geojson` is some geojson file\ncurl -X POST -H \"Content-Type: application/json\" -d @data.geojson localhost:8000/geojson\n```\n\n### `GET /geojson`\n\nGet the geojson objects from the db.\n\n```sh\ncurl -X GET localhost:8000/geojson\n```\n\n```json\n[\n  {\n    \"type\": \"FeatureCollection\",\n    \"features\": [\n      {\n        \"type\": \"Feature\",\n        \"properties\": {},\n        \"geometry\": {\n          \"coordinates\": [\n            [\n              [\n                -79.05384859000527,\n                43.25389088469879\n              ],\n              [\n                -79.05384859000527,\n                42.48475162030496\n              ],\n              [\n                -77.2358957097201,\n                42.48475162030496\n              ],\n              [\n                -77.2358957097201,\n                43.25389088469879\n              ],\n              [\n                -79.05384859000527,\n                43.25389088469879\n              ]\n            ]\n          ],\n          \"type\": \"Polygon\"\n        }\n      }\n    ]\n  }\n]\n```\n### `GET /version`\n\nGet the hash and version of the sky brightness model.\n\n```sh\ncurl -X GET localhost:8000/version\n```\n\n```json\n{\n  \"hash\": \"9b1063ca1c578d67d33b2150ae1a8e5c9c7d87e1261373f2c507a2dd5fe37bf4\",\n  \"version\": \"0.0.1\"\n}\n\n```\n\n## licensing\n\nThis project is licensed under the AGPL-3.0 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonnontrivial%2Fctts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnonnontrivial%2Fctts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonnontrivial%2Fctts/lists"}