camels-aus
  • Home
  • Code Documentation
  • Sample notebook

Appendix

  • Tech Notes
camels-aus
  • Docs »
  • ---

CAMELS-AUS¶

camels-aus facilitates access from Python to the CAMELS-AUS dataset: Fowler, K. J. A., Acharya, S. C., Addor, N., Chou, C., and Peel, M. C.: CAMELS-AUS: Hydrometeorological time series and landscape attributes for 222 catchments in Australia, Earth Syst. Sci. Data Discuss. [preprint], https://doi.org/10.5194/essd-2020-228, in review, 2021.

In [ ]:
Copied!
import os
from camels_aus.repository import CamelsAus, download_camels_aus
import os from camels_aus.repository import CamelsAus, download_camels_aus

CamelsAus is a repository that takes care of loading the data from disk and fives it access as a consolidated dataset to the user, using xarray for most data.

In [ ]:
Copied!
repo = CamelsAus()
repo = CamelsAus()

download_camels_aus streamlines downloading and extracting the files making up CAMELS-AUS 1.0.

In [ ]:
Copied!
camels_dir = os.path.join(os.getenv("HOME"), 'data/camels/aus')
download_camels_aus(camels_dir)
camels_dir = os.path.join(os.getenv("HOME"), 'data/camels/aus') download_camels_aus(camels_dir)
In [ ]:
Copied!
repo.load_from_text_files(camels_dir)
repo.data
repo.load_from_text_files(camels_dir) repo.data
In [ ]:
Copied!
import pandas as pd
time_interval = slice(pd.Timestamp('2009-01-01'), pd.Timestamp('2012-01-01')) 
repo.data.streamflow_mmd.sel(station_id='912101A', time=time_interval).plot(figsize = (16,4))
import pandas as pd time_interval = slice(pd.Timestamp('2009-01-01'), pd.Timestamp('2012-01-01')) repo.data.streamflow_mmd.sel(station_id='912101A', time=time_interval).plot(figsize = (16,4))
In [ ]:
Copied!
repo.boundaries.plot()
repo.boundaries.plot()

Experimental interactive viewer with ipyleaflet¶

Using personal experimental components (ipyleaflet-dashboard-tools) that should probably find a home to leafmaptools

leaflet_viewer_teaser.png

The following cells may work if you have installed ipleaflet and the experimental ipyleaflet tools. This is under constructions and not documented in details

In [ ]:
Copied!
import matplotlib
from ipywidgets import Output, HBox
from ipyleaflet_dashboard_tools.gv import *

import json
from ipyleaflet import Map, GeoJSON
import matplotlib from ipywidgets import Output, HBox from ipyleaflet_dashboard_tools.gv import * import json from ipyleaflet import Map, GeoJSON
In [ ]:
Copied!
%%time 
ds = repo.data
v = GeoViewer(ds, lat='lat_outlet', lon='long_outlet', key='station_id')

out = Output()

click_handler_plot_ts = v.mk_click_handler_plot_ts(out, variable="streamflow_mmd")
mapview = v.build_map(click_handler_plot_ts)

mapview.layout.height = '600px'
%%time ds = repo.data v = GeoViewer(ds, lat='lat_outlet', lon='long_outlet', key='station_id') out = Output() click_handler_plot_ts = v.mk_click_handler_plot_ts(out, variable="streamflow_mmd") mapview = v.build_map(click_handler_plot_ts) mapview.layout.height = '600px'
In [ ]:
Copied!
%%time 
gj = repo.boundaries.to_json()
d = json.loads(gj)
%%time gj = repo.boundaries.to_json() d = json.loads(gj)
In [ ]:
Copied!
%%time 
geo_json = GeoJSON(data=d, style = {'color': 'Blue', 'opacity':1, 'weight':1.9, 'dashArray':'9', 'fillOpacity':0.1})
mapview.add_layer(geo_json)
%%time geo_json = GeoJSON(data=d, style = {'color': 'Blue', 'opacity':1, 'weight':1.9, 'dashArray':'9', 'fillOpacity':0.1}) mapview.add_layer(geo_json)
In [ ]:
Copied!
HBox([mapview, out])
HBox([mapview, out])
In [ ]:
Copied!


Built with MkDocs using a theme provided by Read the Docs.