{"id":23346994,"url":"https://github.com/robintw/rtwrtm","last_synced_at":"2026-03-20T01:14:46.646Z","repository":{"id":137660914,"uuid":"46364499","full_name":"robintw/rtwrtm","owner":"robintw","description":"Monte Carlo Ray Tracing Radiative Transfer Model (RTM)","archived":false,"fork":false,"pushed_at":"2015-11-17T20:18:48.000Z","size":783,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T13:39:50.713Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"IDL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robintw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-17T17:46:50.000Z","updated_at":"2024-05-01T16:28:02.000Z","dependencies_parsed_at":"2023-03-13T18:37:19.252Z","dependency_job_id":null,"html_url":"https://github.com/robintw/rtwrtm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/robintw/rtwrtm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robintw%2Frtwrtm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robintw%2Frtwrtm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robintw%2Frtwrtm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robintw%2Frtwrtm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robintw","download_url":"https://codeload.github.com/robintw/rtwrtm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robintw%2Frtwrtm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28631937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":[],"created_at":"2024-12-21T07:17:22.785Z","updated_at":"2026-03-20T01:14:46.638Z","avatar_url":"https://github.com/robintw.png","language":"IDL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RTWRTM\n\nThis is the code for the RTWRTM model, a very simple ray-tracing Radiative Transfer Model written as part of my MSc thesis. It is *not* suitable for any production use in any way - but may be useful to others in seeing how Radiative Transfer Models can be implemented.\n\nThe thesis I wrote is available in the `docs` folder, along with an extract from the thesis showing how each individual ray is treated.\n\nThe code is written in IDL, and has been tested using IDL 8.5. To run it, load IDL and change to the directory containing the code and then run something like the following:\n\n```\nresult = RUN_RTM(0, 0, 0)\n```\n\nThis will produce results with the default parameterisation with *no* cloud in the sky. To include the pre-defined cloud, change the values of `0, 0, 0` to `x, y, 1` where `x` and `y` are the location of the centre of the cloud on the grid.\n\nIf you're interested in a model that can do this sort of thing *properly* then investigate the Discrete Anisotropic Radiative Transfer model (DART) - see http://www.cesbio.ups-tlse.fr/us/dart.html.\n\n---\n\n## Python version\n\nThe IDL code has been ported to Python with NumPy/Numba for significantly better performance. See `demo.ipynb` for an interactive walkthrough.\n\n### Installation\n\n```bash\npip install numba numpy scipy matplotlib jupyter\n```\n\n### Running\n\n**Command line:**\n\n```bash\n# Default run (no cloud)\npython run_rtm.py\n\n# With cloud centred at grid position (10, 10)\npython run_rtm.py --cloud 10 10\n\n# Show a plot after the run\npython run_rtm.py --plot\n\n# More iterations for a smoother spectrum\npython run_rtm.py --iterations 50000 --plot\n```\n\n**Python API:**\n\n```python\nfrom run_rtm import run_rtm\n\nresult = run_rtm(n_iterations=50000, day_of_year=172, lat=51.5, lon=-0.1)\n\nresult['wavelengths']   # 122 band centres, 0.3–4.0 μm\nresult['vertical']      # irradiance arriving vertically (W m⁻² μm⁻¹)\nresult['left']          # arriving from the left\nresult['right']         # arriving from the right\nresult['total_hits']    # total sensor hits across all wavelengths\n```\n\n### File structure\n\n| File | Purpose |\n|---|---|\n| `run_rtm.py` | Main simulation function + CLI entry point |\n| `rtm_core.py` | Numba-JIT ray tracer (the hot loop) |\n| `rtm_constants.py` | Spectral data arrays and helper functions |\n| `demo.ipynb` | Jupyter notebook demo |\n\n### Performance\n\nThe Numba JIT compiler runs on the first call (~10 s), then uses a disk cache for all subsequent calls (~1 s overhead). The simulation parallelises over iterations using all available CPU cores.\n\n| Iterations | Sensor hits | Time |\n|---:|---:|---:|\n| 1,000 | ~230 | 0.1 s |\n| 5,000 | ~1,000 | 0.5 s |\n| 10,000 | ~1,900 | 1.4 s |\n| 50,000 | ~12,000 | 5 s |\n| 100,000 | ~21,000 | 10 s |\n| 500,000 | ~105,000 | 53 s |\n\nThe hit rate is ~0.2% per iteration — rays must scatter to reach the sensor. More iterations give a smoother spectrum.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobintw%2Frtwrtm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobintw%2Frtwrtm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobintw%2Frtwrtm/lists"}