Repository navigation
Conversation
* Fix TCTracks.from_FAST duplicate loading from year loop * Refactor test_from_FAST: extend fixture to 2 years, remove separate regression test The test fixture FAST_test_tracks.nc now has year=[2025,2026] (only seeds_per_month is extended; track variables retain their n_trk dim). The existing len(tc_track.data)==5 assertion now acts as the regression check: the buggy year-loop code would return 5x2=10 tracks. The separate test_from_FAST_not_multiplied_by_year_dim (with its temporary-file scaffolding) is removed. * Update changelo --------- Co-authored-by: Simona Meiler <simona.meiler@usys.ethz.ch> Co-authored-by: Chahan Kropf <chahan.kropf@posteo.com>
|
@emanuel-schmid or @peanutfun, this should be a quick one to review. And will fix some of the currently failing tests. |
|
There are some administrative regions, which lead to an error when trying to create LitPop for them. Please find the code how to determine these below. country_names = global_litpop.gdf.region_id.unique()
iso3a_list = u_coord.country_to_iso(country_names, representation="alpha3")
info_ind = "NY.GDP.MKTP.CD"
data = []
network = []
for cntry_iso in iso3a_list:
try:
cntry_gdp = util_fin.download_world_bank_indicator(indicator=info_ind, country_code=cntry_iso, parse_dates=False)
except (ReadTimeout, RequestException):
print(f"Network issue: {cntry_iso}")
network.append(cntry_iso)
except ValueError as e:
print(f"Data/API issue for {cntry_iso}: {e}")
data.append(cntry_iso)
failing_c = []
for country in data:
print(country)
try:
exp = LitPop.from_countries(country, reference_year=2002)
except ValueError as e:
failing_c.append(country) |
9fe40a6 to
b46eba8
Compare
emanuel-schmid
left a comment
There was a problem hiding this comment.
Looks good to me. In any case an improvement! 🥇
Happy to merge.
| Return requested variable for a country (cntry_iso) and a year (ref_year). | ||
| Download wealth accounting data from the World Bank API and return the requested | ||
| variable for a country (cntry_iso) and a year (ref_year). | ||
| https://datacatalog.worldbank.org/search/dataset/0042066 |
There was a problem hiding this comment.
is this url correct? wasn't it meant to be replaced?
There was a problem hiding this comment.
No this one is still good.
The ones outdated were those (notably the ones pointing to files):
WORLD_BANK_WEALTH_ACC = (
"https://databank.worldbank.org/data/download/Wealth-Accounts_CSV.zip"
)
"""Wealth historical data (1995, 2000, 2005, 2010, 2014) from World Bank (ZIP).
https://datacatalog.worldbank.org/dataset/wealth-accounting
Includes variable Produced Capital (NW.PCA.TO)"""
FILE_WORLD_BANK_WEALTH_ACC = "Wealth-AccountsData.csv"
WORLD_BANK_INC_GRP = (
"http://databank.worldbank.org/data/download/site-content/OGHIST.xls"
)
@carmensteinmann you are right, these country codes are not listed as worldbanks indicators. it's a problem, but not related to this PR. See #1331 |
Co-authored-by: Samuel Juhel <10011382+spjuhel@users.noreply.github.com>
Changes proposed in this PR:
This PR fixes #1291 and #1293
PR Author Checklist
develop)PR Reviewer Checklist