{"id":15555238,"url":"https://github.com/brews/dlong","last_synced_at":"2025-04-23T19:49:19.850Z","repository":{"id":64802319,"uuid":"551000356","full_name":"brews/dlong","owner":"brews","description":"Prototype framework for projected socio-economic climate damages","archived":false,"fork":false,"pushed_at":"2025-03-21T23:11:28.000Z","size":103,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-17T01:27:37.931Z","etag":null,"topics":["example","package","python","toy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brews.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2022-10-13T17:13:50.000Z","updated_at":"2025-03-21T23:11:31.000Z","dependencies_parsed_at":"2024-02-28T21:25:03.591Z","dependency_job_id":"c1c41cb6-4cdf-4bc2-b197-e4a32c318bfa","html_url":"https://github.com/brews/dlong","commit_stats":{"total_commits":64,"total_committers":3,"mean_commits":"21.333333333333332","dds":0.421875,"last_synced_commit":"576b732829c2d039c7f09bc66a21a05e125ecc20"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brews%2Fdlong","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brews%2Fdlong/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brews%2Fdlong/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brews%2Fdlong/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brews","download_url":"https://codeload.github.com/brews/dlong/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250504087,"owners_count":21441527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["example","package","python","toy"],"created_at":"2024-10-02T15:07:29.545Z","updated_at":"2025-04-23T19:49:19.843Z","avatar_url":"https://github.com/brews.png","language":"Python","readme":"[![pythonpackage](https://github.com/brews/dlong/actions/workflows/pythonpackage.yml/badge.svg)](https://github.com/brews/dlong/actions/workflows/pythonpackage.yml)\n[![codecov](https://codecov.io/gh/brews/dlong/branch/main/graph/badge.svg?token=NZI5NI6RSH)](https://codecov.io/gh/brews/dlong)\n\n# dlong\nPrototype framework for projected socio-economic climate damages\n\n\u003e [!CAUTION]\n\u003e This is a prototype. It is likely to change in breaking ways. It might delete all your data. Don't use it in production.\n\n## Examples\n```python\nimport dlong\nfrom dlong.types import ClimateData\nimport xarray as xr\n\n# First, let's make some demo data.\n# Say 3 years of annual temperature data across 3 regions:\nregion = [1, 2, 3]\nyear = [2019, 2020, 2021]\ninput_temperature = xr.DataArray(\n    [[1.0, 2.0, 3.0], [2.0, 3.0, 4.0], [3.0, 4.0, 5.0]],\n    coords=[region, year],\n    dims=[\"region\", \"year\"],\n)\n# And here are coefficients for a quadratic damage function. Different for \n# each region.\ndamage_coefficients = xr.Dataset(\n    data_vars={\n        \"beta0\": ([\"region\"], [1, 1, 1]),\n        \"beta1\": ([\"region\"], [1, 2, 3]),\n        \"beta2\": ([\"region\"], [4, 5, 6]),\n    },\n    coords={\"region\": ([\"region\"], region)},\n)\n\n# Put it all together to describe climate data, a damage function, and\n# a strategy for discounting damages.\nclimate = ClimateData(temperature=input_temperature)\ndamage_model = dlong.QuadraticDamageModel(coefs=damage_coefficients)\ndiscount_strategy = dlong.FractionalDiscount(rate=0.02, reference_year=2020)\n# We could use these individually, or combine them into a \"recipe\" to output \n# discounted damages. The idea is that these components are compositable\n# so components can be customized and run in large batches.\nrecipe = dlong.ExampleRecipe(\n    climate=climate, damage_function=damage_model, discount=discount_strategy\n)\ndamages = recipe.discounted_damages()\n#\u003cxarray.DataArray (region: 3, year: 3)\u003e\n#array([[  6.12      ,  19.        ,  39.21568627],\n#       [ 25.5       ,  52.        ,  87.25490196],\n#       [ 65.28      , 109.        , 162.74509804]])\n#Coordinates:\n#* region   (region) int64 1 2 3\n#* year     (year) int64 2019 2020 2021\n```\n\n## Installation\n```shell\npip install dlong\n```\n\n`dlong` currently requires Python \u003e 3.8 and the `xarray` package.\n\nInstall the unreleased bleeding-edge version of the package with:\n```shell\npip install git+https://github.com/brews/dlong\n```\n\n## Support\nSource code is available online at https://github.com/brews/dlong/. This software is Open Source and available under the Apache License, Version 2.0.\n\n## Development\n\nPlease file bugs in the [bug tracker](https://github.com/brews/dlong/issues).\n\nWant to contribute? Great! Fork the main branch and file a pull request when you're ready. Please be sure to write unit tests and follow [pep8](https://www.python.org/dev/peps/pep-0008/). Fork away!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrews%2Fdlong","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrews%2Fdlong","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrews%2Fdlong/lists"}