Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move package data #781

Merged
merged 4 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Code freeze date: YYYY-MM-DD

### Changed

- Rearranged file-system structure: `data` directory moved into `climada` package directory. [#781](https://github.com/CLIMADA-project/climada_python/pull/781)

### Fixed

### Deprecated
Expand Down
6 changes: 3 additions & 3 deletions climada/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
GSDP_DIR = SYSTEM_DIR.joinpath('GSDP')

REPO_DATA = {
'data/system': [
'climada/data/system': [
ISIMIP_GPWV3_NATID_150AS,
GLB_CENTROIDS_MAT,
ENT_TEMPLATE_XLS,
Expand All @@ -44,12 +44,12 @@
SYSTEM_DIR.joinpath('tc_impf_cal_v01_EDR.csv'),
SYSTEM_DIR.joinpath('tc_impf_cal_v01_RMSF.csv'),
],
'data/system/GSDP': [
'climada/data/system/GSDP': [
GSDP_DIR.joinpath(f'{cc}_GSDP.xls')
for cc in ['AUS', 'BRA', 'CAN', 'CHE', 'CHN', 'DEU', 'FRA', 'IDN', 'IND', 'JPN', 'MEX',
'TUR', 'USA', 'ZAF']
],
'data/demo': [
'climada/data/demo': [
ENT_DEMO_TODAY,
ENT_DEMO_FUTURE,
EXP_DEMO_H5,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion doc/guide/Guide_Euler.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"{\n",
" \"local_data\": {\n",
" \"system\": \"/cluster/work/climate/USERNAME/climada/data\",\n",
" \"demo\": \"/cluster/project/climate/USERNAME/climada_python/data/demo\",\n",
" \"demo\": \"/cluster/project/climate/USERNAME/climada/data/demo\",\n",
" \"save_dir\": \"/cluster/work/climate/USERNAME/climada/results\"\n",
" }\n",
"}\n",
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorial/1_main_climada.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@
"\n",
"The entity class is a container class that stores exposures and impact functions (vulnerability curves) needed for a risk calculation, and the discount rates and adaptation measures for an adaptation cost-benefit analysis.\n",
"\n",
"As with Hazard objects, Entities can be read from files or created through code. The Excel template can be found in `climada_python/data/system/entity_template.xlsx`.\n",
"As with Hazard objects, Entities can be read from files or created through code. The Excel template can be found in `climada_python/climada/data/system/entity_template.xlsx`.\n",
"\n",
"In this tutorial we will create an Exposure object using the LitPop economic exposure module, and load a pre-defined wind damage function."
]
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorial/climada_entity_DiscRates.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"source": [
"## Read discount rates of an Excel file\n",
"\n",
"Discount rates defined in an excel file following the template provided in sheet `discount` of `climada_python/data/system/entity_template.xlsx` can be ingested directly using the method `from_excel()`."
"Discount rates defined in an excel file following the template provided in sheet `discount` of `climada_python/climada/data/system/entity_template.xlsx` can be ingested directly using the method `from_excel()`."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorial/climada_entity_Exposures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@
"### Exposures from an excel file\n",
"\n",
"If you manually collect exposure data, Excel may be your preferred option. \n",
"In this case, it is easiest if you format your data according to the structure provided in the template `climada_python/data/system/entity_template.xlsx`, in the sheet `assets`."
"In this case, it is easiest if you format your data according to the structure provided in the template `climada_python/climada/data/system/entity_template.xlsx`, in the sheet `assets`."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorial/climada_entity_ImpactFuncSet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"source": [
"#### Reading impact functions from an Excel file\n",
"\n",
"Impact functions defined in an excel file following the template provided in sheet `impact_functions` of `climada_python/data/system/entity_template.xlsx` can be ingested directly using the method `from_excel()`."
"Impact functions defined in an excel file following the template provided in sheet `impact_functions` of `climada_python/climada/data/system/entity_template.xlsx` can be ingested directly using the method `from_excel()`."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorial/climada_entity_MeasureSet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
" * name (str): name of the action\n",
" * haz_type (str): related hazard type (peril), e.g. TC\n",
" * color_rgb (np.array): integer array of size 3. Gives color code of this measure in RGB\n",
" * cost (float): discounted cost (in same units as assets). Needs to be provided by the user. See the example provided in `climada_python/data/system/entity_template.xlsx` sheets `_measures_details` and `_discounting_sheet` to see how the discounting is done.\n",
" * cost (float): discounted cost (in same units as assets). Needs to be provided by the user. See the example provided in `climada_python/climada/data/system/entity_template.xlsx` sheets `_measures_details` and `_discounting_sheet` to see how the discounting is done.\n",
" \n",
"Related to a measure's impact:\n",
" * hazard_set (str): file name of hazard to use\n",
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorial/climada_hazard_Hazard.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
"<a id='Part2'></a> \n",
"## Part 2: Read hazards from other data\n",
"\n",
"- excel: Hazards can be read from Excel files following the template in `climada_python/data/system/hazard_template.xlsx` using the `from_excel()` method. \n",
"- excel: Hazards can be read from Excel files following the template in `climada_python/climada/data/system/hazard_template.xlsx` using the `from_excel()` method. \n",
"- MATLAB: Hazards generated with CLIMADA's MATLAB version (.mat format) can be read using `from_mat()`.\n",
"- vector data: Use `Hazard`'s `from_vector`-constructor to read shape data (all formats supported by [fiona](https://fiona.readthedocs.io/en/latest/manual.html)).\n",
"- hdf5: Hazards generated with the CLIMADA in Python (.h5 format) can be read using `from_hdf5()`."
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorial/climada_hazard_TropCyclone.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@
"<a id='Part1.a'></a> \n",
"## a) Load TC tracks from historical records\n",
"\n",
"The best-track historical data from the International Best Track Archive for Climate Stewardship ([IBTrACS](https://www.ncdc.noaa.gov/ibtracs/)) can easily be loaded into CLIMADA to study the historical records of TC events. The constructor `from_ibtracs_netcdf()` generates the `Datasets` for tracks selected by [IBTrACS](https://www.ncdc.noaa.gov/ibtracs/) id, or by basin and year range. To achieve this, it downloads the first time the [IBTrACS data v4 in netcdf format](https://www.ncei.noaa.gov/data/international-best-track-archive-for-climate-stewardship-ibtracs/v04r00/access/netcdf/) and stores it in `climada_python/data/system`. The tracks can be accessed later either using the attribute `data` or using `get_track()`, which allows to select tracks by its name or id. Use the method `append()` to extend the `data` list.\n",
"The best-track historical data from the International Best Track Archive for Climate Stewardship ([IBTrACS](https://www.ncdc.noaa.gov/ibtracs/)) can easily be loaded into CLIMADA to study the historical records of TC events. The constructor `from_ibtracs_netcdf()` generates the `Datasets` for tracks selected by [IBTrACS](https://www.ncdc.noaa.gov/ibtracs/) id, or by basin and year range. To achieve this, it downloads the first time the [IBTrACS data v4 in netcdf format](https://www.ncei.noaa.gov/data/international-best-track-archive-for-climate-stewardship-ibtracs/v04r00/access/netcdf/) and stores it in `~/climada/data/`. The tracks can be accessed later either using the attribute `data` or using `get_track()`, which allows to select tracks by its name or id. Use the method `append()` to extend the `data` list.\n",
"\n",
"If you get an error downloading the IBTrACS data, try to manually access [https://www.ncei.noaa.gov/data/international-best-track-archive-for-climate-stewardship-ibtracs/v04r00/access/netcdf/](https://www.ncei.noaa.gov/data/international-best-track-archive-for-climate-stewardship-ibtracs/v04r00/access/netcdf/), click on the file `IBTrACS.ALL.v04r00.nc` and copy it to `climada_python/data/system`.\n",
"If you get an error downloading the IBTrACS data, try to manually access [https://www.ncei.noaa.gov/data/international-best-track-archive-for-climate-stewardship-ibtracs/v04r00/access/netcdf/](https://www.ncei.noaa.gov/data/international-best-track-archive-for-climate-stewardship-ibtracs/v04r00/access/netcdf/), click on the file `IBTrACS.ALL.v04r00.nc` and copy it to `~/climada/data/`.\n",
"\n",
"To visualize the tracks use `plot()`.\n"
]
Expand Down
12 changes: 5 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""

from pathlib import Path
from setuptools import find_packages, setup
from setuptools import setup, find_namespace_packages

here = Path(__file__).parent.absolute()

Expand Down Expand Up @@ -48,9 +48,6 @@
license='OSI Approved :: GNU Lesser General Public License v3 (GPLv3)',

classifiers=[
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 4 - Beta',
'Programming Language :: Python :: 3.9',
'Topic :: Scientific/Engineering :: Atmospheric Science',
Expand All @@ -60,8 +57,6 @@

keywords='climate adaptation',

packages=find_packages() + ['data'],

install_requires=[
'bottleneck',
'cartopy',
Expand Down Expand Up @@ -104,5 +99,8 @@
"dev": DEPS_DOC + DEPS_TEST
},

include_package_data=True
packages=find_namespace_packages(include=['climada*']),

setup_requires=['setuptools_scm'],
include_package_data=True,
)