Skip to content

Commit

Permalink
[compliance] carbon_flux (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximlt authored Oct 30, 2023
1 parent 667dbef commit b666a9e
Show file tree
Hide file tree
Showing 10 changed files with 3,443 additions and 1,008 deletions.
1,788 changes: 821 additions & 967 deletions carbon_flux/anaconda-project-lock.yml

Large diffs are not rendered by default.

57 changes: 27 additions & 30 deletions carbon_flux/anaconda-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,50 @@ examples_config:
maintainers:
- jbednar
- jlstevens
created: 2018-11-28
labels:
- datashader
- geoviews

user_fields: [examples_config]

channels: [pyviz, defaults]
channels: [defaults]

packages: &pkgs
- python=3.7
- notebook
- bokeh
- python=3.8
- notebook <7
- bokeh <2.4
- dask <2021.10
- colorcet
- datashader
- hvplot
- fastparquet
- holoviews
- geoviews
- param
- intake
- s3fs
- matplotlib
- pandas=1.2.5
- python-snappy
- datashader =0.13.0
- hvplot =0.7.3
- fastparquet =0.5.0
- holoviews =1.14.5
- geoviews =1.9.1
- param =1.11.1
- intake =0.6.2
- s3fs =2021.7.0
- matplotlib <3.5
- pandas <1.4
- python-snappy =0.6.0
# Not direct deps but needed for the projects to run
- numba <0.55
- numpy <1.21
- jinja2 <3
- markupSafe =2.0.1
- aiobotocore=1.2.2

dependencies: *pkgs

variables:
INTAKE_CACHE_DIR: data

commands:
notebook:
notebook: Carbon_Flux.ipynb
test:
unix: pytest --nbsmoke-run -k *.ipynb --ignore envs
windows: pytest --nbsmoke-run -k *.ipynb --ignore envs
env_spec: test
lint:
unix: pytest --nbsmoke-lint -k *.ipynb --ignore envs
windows: pytest --nbsmoke-lint -k *.ipynb --ignore envs
env_spec: test

env_specs:
default: {}
test:
packages: &testpkgs
- nbsmoke ==0.2.8
- pytest ==4.4.1
dependencies: *testpkgs
platforms:
- linux-64
- osx-64
- win-64
- osx-arm64
34 changes: 25 additions & 9 deletions carbon_flux/carbon_flux.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Carbon Flux\n",
"Written by Jean-Luc Stevens<br>\n",
"Created: November 28, 2018<br>\n",
"Last updated: June 30, 2020"
"# Carbon Flux"
]
},
{
Expand Down Expand Up @@ -45,11 +42,11 @@
"\n",
"import holoviews as hv\n",
"\n",
"import hvplot.pandas\n",
"import hvplot.pandas # noqa\n",
"import geoviews.tile_sources as gts\n",
"\n",
"pd.options.display.max_columns = 10\n",
"hv.extension('bokeh', width=80)"
"hv.extension('bokeh')"
]
},
{
Expand Down Expand Up @@ -273,7 +270,13 @@
"for i, s3_path in enumerate(s3_paths):\n",
" sys.stdout.write('\\r{}/{}'.format(i+1, len(s3_paths)))\n",
" \n",
" dd = cat.fluxnet_daily(s3_path=s3_path).to_dask()\n",
" try:\n",
" dd = cat.fluxnet_daily(s3_path=s3_path).to_dask()\n",
" except FileNotFoundError:\n",
" try:\n",
" dd = cat.fluxnet_daily(s3_path=s3_path.split('/')[-1]).to_dask()\n",
" except FileNotFoundError:\n",
" continue\n",
" site = dd['site'].cat.categories.item()\n",
" \n",
" if not set(dd.columns) >= set(data_columns):\n",
Expand Down Expand Up @@ -838,7 +841,7 @@
"metadata": {},
"outputs": [],
"source": [
"timeseries_observed_vs_predicted(test_sites[1])"
"timeseries_observed_vs_predicted(test_sites[0])"
]
},
{
Expand Down Expand Up @@ -1074,9 +1077,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"pygments_lexer": "ipython3"
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.18"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion carbon_flux/catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ sources:
header: null
names: ['site', 'lat', 'lon', 'igbp', 'network']
usecols: ['site', 'lat', 'lon', 'igbp']
storage_options: {'anon': True}
storage_options: {'anon': True}
Binary file modified carbon_flux/thumbnails/carbon_flux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Effectively only catching pyflakes (F) errors, like `F401: module imported but unused`
# All the list of flake8 rules available at https://www.flake8rules.com/
flake8 = [
"--extend-ignore=E,W,C"
"--extend-ignore=E,C,W"
]

[tool.nbqa.exclude]
Expand Down
1,097 changes: 1,097 additions & 0 deletions test_data/carbon_flux/FLX_AU-RDF_FLUXNET2015_FULLSET_DD_2011-2013_1-3.csv

Large diffs are not rendered by default.

1,097 changes: 1,097 additions & 0 deletions test_data/carbon_flux/FLX_US-Tw1_FLUXNET2015_FULLSET_DD_2012-2014_1-3.csv

Large diffs are not rendered by default.

Loading

0 comments on commit b666a9e

Please sign in to comment.