A tool for dataset comparison: Observational Data at a point location
Overview
This page contains Python code that can extract and display historical climate data from different sources at a point location for comparison. The code can be run on the PAVICS platform or a locally configured Python environment with Jupyter Notebook or Jupyter Lab functionality enabled. It relys on the data available on PAVICS, but other data from other sources may be introduced.
Two versions are shown:
A simple script that may be modified by the user to control the output figure.
A script that generates an interactive dashboard with widgets for the user to control the output of the figure.
WarningNote
The code sections below can not be executed on this web page. For them to be run they will need to be copied to a Jupyter Notebook on PAVICS or a local Python environment.
A simple script
This script generates a figure to compare datasets of historical climate.
First we need to import libraries and define the data
The following section determines the content of the figure in terms of the datasets, the point location, the time period and the frequency.
---------- Reading ECCC_AHCCD_gen3_temperature ----------
[########################################] | 100% Completed | 101.36 ms
[########################################] | 100% Completed | 101.00 ms
[########################################] | 100% Completed | 101.13 ms
[########################################] | 100% Completed | 101.42 ms
[########################################] | 100% Completed | 101.09 ms
[########################################] | 100% Completed | 101.55 ms
---------- Reading NRCANMet_v2 ----------
[########################################] | 100% Completed | 27.02 s
---------- Reading RDRSv2.1 ----------
[########################################] | 100% Completed | 101.21 ms
[########################################] | 100% Completed | 101.01 ms
[########################################] | 100% Completed | 101.12 ms
[########################################] | 100% Completed | 302.65 ms
[########################################] | 100% Completed | 13.00 s
---------- Reading ERA5-Land ----------
[########################################] | 100% Completed | 50.95 s
{'ECCC_AHCCD_gen3_temperature': 'tmp/ECCC_AHCCD_gen3_temperature_lat45.0_lon-72.0.nc', 'NRCANMet_v2': 'tmp/NRCANMet_v2_lat45.0_lon-72.0.nc', 'RDRSv2.1': 'tmp/RDRSv2.1_lat45.0_lon-72.0.nc', 'ERA5-Land': 'tmp/ERA5-Land_lat45.0_lon-72.0.nc'}
Creating the interactive dashboard
The following code section uses the panel library to create a user interface to interactively modify the figure. It uses the above functions to update the figure accordingly.