Quadica dataset

This file shows how to use the Quadica dataset from the aqua_fetch package.

[1]:
# sphinx_gallery_thumbnail_number = 3

import os
import site

if __name__ == '__main__':
    wd_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath('__file__')))))
    # wd_dir = os.path.dirname(os.path.dirname(os.path.realpath('__file__')))
    print(wd_dir)
    site.addsitedir(wd_dir)

import pandas as pd
import matplotlib.pyplot as plt
from easy_mpl import hist, ridge
from easy_mpl.utils import create_subplots

from aqua_fetch import Quadica
from aqua_fetch.utils import print_info
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest
[2]:
print_info()
numpy 1.26.4
pandas 2.1.4
water_quality 0.1.0
python 3.12.7 (main, Nov  5 2024, 17:00:24) [GCC 9.4.0]
os posix
matplotlib 3.8.4
xarray 2024.7.0
netCDF4 1.7.2
scipy 1.15.1
Script Executed on:  19 January 2025 12:13:32
tot_cpus 2
avail_cpus 2
mem_gib 7.612831115722656
[3]:
dataset = Quadica()

        Not downloading the data since the directory
        /home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/data/Quadica already exists.
        Use overwrite=True to remove previously saved files and download again
[4]:
avg_temp = dataset.avg_temp()
print(avg_temp.shape)
(828, 1386)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:303: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  temp.index = pd.to_datetime(temp.index)
[5]:
[5]:
1 2 3 4 8 9 10 11 12 16 ... 651 655 660 1002 1007 1012 1013 1277 1279 1281
Year_Month
1950-01-01 -2.297333 -2.459127 -2.342236 -2.014634 -1.537954 -1.470925 -2.055828 -2.097191 -2.068334 -1.822387 ... -1.627405 -2.270952 -2.310768 0.328745 0.124732 -0.292483 0.567522 -4.408611 -4.568310 -4.675208
1950-02-01 2.526310 2.694384 2.198610 2.699495 2.684751 2.752606 2.562898 2.520741 2.582700 2.225678 ... 2.099005 2.235437 2.112160 2.358829 2.370221 2.440856 2.475693 0.020008 -0.113062 -0.189216
1950-03-01 4.627410 4.638905 4.186086 4.550262 4.430630 4.496324 4.330999 4.378834 4.515958 4.683892 ... 4.605748 4.207512 4.194073 4.618830 4.334336 4.740807 4.700609 1.695298 1.543320 1.447536
1950-04-01 7.486832 7.736304 6.937535 7.645946 7.220503 7.269880 7.439249 7.441809 7.561507 6.772806 ... 6.720880 6.992037 6.863719 6.592855 6.411006 6.556426 6.743028 3.662794 3.435914 3.297304
1950-05-01 15.043045 15.376076 14.239087 15.069802 14.471546 14.508084 14.844470 14.888297 15.032875 13.734928 ... 13.117943 14.169679 14.103170 12.123150 11.489081 12.261512 12.224808 11.124089 10.931649 10.808384

5 rows × 1386 columns

pet

[6]:
pet = dataset.pet()
print(pet.shape)
(828, 1386)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:254: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pet.index = pd.to_datetime(pet.index)

precipitation

[7]:
pcp = dataset.precipitation()
print(pcp.shape)
(828, 1386)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:350: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pcp.index = pd.to_datetime(pcp.index)

monthly median values

[8]:
mon_medians = dataset.monthly_medians()
print(mon_medians.shape)
(16629, 17)
[9]:
Month n_Q median_Q n_NO3 median_NO3N n_NMin median_NMin n_TN median_TN n_PO4 median_PO4P n_TP median_TP n_DOC median_DOC n_TOC median_TOC
OBJECTID
1 1 0 NaN 11 1.700 11 1.960 11 3.60 11 0.0250 11 0.1180 0 NaN 11 6.60
1 2 0 NaN 12 1.740 12 1.975 12 4.30 12 0.0285 12 0.1375 0 NaN 12 6.85
1 3 0 NaN 11 1.900 11 2.100 11 4.70 11 0.0220 11 0.0880 0 NaN 11 7.50
1 4 0 NaN 10 1.405 10 1.580 10 2.95 10 0.0150 10 0.1115 0 NaN 10 7.00
1 5 0 NaN 11 1.000 11 1.260 11 2.60 11 0.0280 11 0.1550 0 NaN 11 9.00
[10]:
wrtds_mon = dataset.wrtds_monthly()
print(wrtds_mon.shape)
(50186, 47)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:144: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  wrtds.index = pd.to_datetime(wrtds['Year'].astype(str) + ' ' + wrtds['Month'].astype(str))

catchment attributes

[11]:
cat_attrs = dataset.catchment_attributes()
print(cat_attrs.shape)
(1386, 112)
[12]:
Index(['Station', 'Area_km2', 'f_AreaGer', 'dem.mean', 'dem.median',
       'slo.mean', 'slo.median', 'twi.mean', 'twi.med', 'twi.90p',
       ...
       'flashi', 'BFI', 'P_mm', 'P_SIsw', 'P_SI', 'P_lambda', 'P_alpha',
       'PET_mm', 'AI', 'T_mean'],
      dtype='object', length=112)
[13]:
dataset.catchment_attributes(stations=['1', '2', '3'])
[13]:
Station Area_km2 f_AreaGer dem.mean dem.median slo.mean slo.median twi.mean twi.med twi.90p ... flashi BFI P_mm P_SIsw P_SI P_lambda P_alpha PET_mm AI T_mean
OBJECTID
1 BB_AMFL_0010 21.65 1.0 74.683632 72.135452 0.750141 0.678210 15.002993 14.357248 17.938291 ... NaN NaN 589.535167 1.338849 2.044286 0.322334 5.007660 760.654789 1.290294 9.425497
2 BB_AZMFL_0010 50.47 1.0 61.898052 56.878677 1.157724 0.823584 14.753934 14.246800 17.612621 ... 0.0 0.878186 544.733603 1.661279 2.726427 0.306447 4.866778 774.804494 1.422743 9.381932
3 BB_BAFL_0010 56.19 1.0 48.056680 50.443848 0.973699 0.846759 14.805566 14.195425 17.810382 ... NaN NaN 535.680048 1.813461 3.034012 0.308551 4.753558 719.133840 1.342496 8.983454

3 rows × 112 columns

monthly data

[14]:
dyn, cat = dataset.fetch_monthly(max_nan_tol=None)
print(dyn.shape)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:144: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  wrtds.index = pd.to_datetime(wrtds['Year'].astype(str) + ' ' + wrtds['Month'].astype(str))
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:303: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  temp.index = pd.to_datetime(temp.index)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:350: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pcp.index = pd.to_datetime(pcp.index)
(29484, 33)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:254: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pet.index = pd.to_datetime(pet.index)
[15]:
dyn['OBJECTID'].unique()
[15]:
array(['1011', '1016', '1017', '1019', '1082', '1113', '1186', '1237',
       '1238', '1255', '1270', '1271', '1275', '1287', '1303', '1332',
       '1467', '1473', '1482', '1495', '1570', '1571', '1573', '1672',
       '1677', '1678', '1679', '1680', '1683', '1688', '1690', '1691',
       '333', '334', '335', '336', '337', '340', '341', '342', '345',
       '346', '347', '348', '349', '350', '352', '355', '358', '359',
       '360', '362', '363', '364', '365', '368', '370', '373', '374',
       '376', '380', '381', '391', '393', '637', '663', '667', '673',
       '678', '686', '687', '688', '690', '692', '696', '701', '705',
       '711', '716', '718', '722', '723', '728', '730', '734', '735',
       '736', '737', '739', '740', '742', '744', '745', '746', '750',
       '752', '754', '769', '773', '774', '775', '776', '778', '782',
       '783', '785', '786', '787', '789', '796', '797', '874', '885',
       '899', '985', '986', '991'], dtype=object)
[16]:
print(dyn.columns)
Index(['median_C_NMin', 'median_FNC_TN', 'median_FNC_TP', 'mean_FNFlux_TOC',
       'mean_FNFlux_TP', 'mean_FNFlux_PO4', 'mean_Flux_TN', 'median_C_TN',
       'median_C_DOC', 'mean_Flux_NO3', 'median_C_PO4', 'median_C_TP',
       'median_FNC_NMin', 'mean_FNFlux_TN', 'median_Q', 'mean_Flux_DOC',
       'median_C_TOC', 'mean_Flux_TP', 'median_FNC_NO3', 'mean_Flux_NMin',
       'median_FNC_TOC', 'median_FNC_DOC', 'mean_Flux_TOC', 'mean_FNFlux_NMin',
       'mean_FNFlux_DOC', 'median_FNC_PO4', 'mean_FNFlux_NO3', 'median_C_NO3',
       'mean_Flux_PO4', 'OBJECTID', 'avg_temp', 'precip', 'pet'],
      dtype='object')
[17]:
print(dyn.isna().sum())
median_C_NMin        9161
median_FNC_TN       18880
median_FNC_TP        1819
mean_FNFlux_TOC     15469
mean_FNFlux_TP       1819
mean_FNFlux_PO4      1988
mean_Flux_TN        18880
median_C_TN         18880
median_C_DOC        16361
mean_Flux_NO3        2691
median_C_PO4         1988
median_C_TP          1819
median_FNC_NMin      9161
mean_FNFlux_TN      18880
median_Q               13
mean_Flux_DOC       16361
median_C_TOC        15456
mean_Flux_TP         1819
median_FNC_NO3       2709
mean_Flux_NMin       9161
median_FNC_TOC      15469
median_FNC_DOC      16361
mean_Flux_TOC       15456
mean_FNFlux_NMin     9161
mean_FNFlux_DOC     16361
median_FNC_PO4       1988
mean_FNFlux_NO3      2709
median_C_NO3         2691
mean_Flux_PO4        1988
OBJECTID                0
avg_temp                0
precip                  0
pet                     0
dtype: int64
[18]:
print(cat.shape)
(29484, 112)

monthly TN

[19]:
dyn, cat = dataset.fetch_monthly(parameters="TN", max_nan_tol=0)
print(dyn.shape)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:144: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  wrtds.index = pd.to_datetime(wrtds['Year'].astype(str) + ' ' + wrtds['Month'].astype(str))
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:303: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  temp.index = pd.to_datetime(temp.index)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:350: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pcp.index = pd.to_datetime(pcp.index)
(6300, 9)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:254: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pet.index = pd.to_datetime(pet.index)
[20]:
[20]:
mean_FNFlux_TN median_Q median_FNC_TN mean_Flux_TN median_C_TN OBJECTID avg_temp precip pet
1993-01-01 15231.802979 26.830 6.146777 15385.732237 6.031168 1016 3.522219 87.729192 13.233763
1993-02-01 13883.296467 14.915 6.063398 9013.965119 6.683056 1016 -0.751842 17.499132 11.923154
1993-03-01 12208.820505 10.550 5.916351 6399.883526 6.875362 1016 4.395708 9.086743 46.873238
1993-04-01 8862.132520 10.090 5.791805 5857.966285 6.473212 1016 10.420328 34.628064 82.216114
1993-05-01 6973.986038 10.480 5.683456 6134.053878 6.021999 1016 13.843144 100.724108 112.228591
[21]:
[21]:
mean_FNFlux_TN median_Q median_FNC_TN mean_Flux_TN median_C_TN OBJECTID avg_temp precip pet
2013-08-01 868.456700 2.70 2.638713 596.596256 2.538385 991 17.427514 46.309400 112.389357
2013-09-01 900.594832 2.55 2.688586 581.025792 2.550167 991 13.039871 71.339231 59.626034
2013-10-01 1175.224141 3.42 2.941018 835.206639 2.895106 991 11.067293 78.249183 31.262571
2013-11-01 1895.196572 4.77 3.445098 1529.151146 3.376280 991 5.443935 63.361708 11.133313
2013-12-01 2958.770365 7.43 3.918537 2669.605407 3.973231 991 4.831621 71.560471 7.538275
[22]:
print(dyn.isna().sum())
mean_FNFlux_TN    0
median_Q          0
median_FNC_TN     0
mean_Flux_TN      0
median_C_TN       0
OBJECTID          0
avg_temp          0
precip            0
pet               0
dtype: int64
[23]:
dyn['OBJECTID'].unique()
[23]:
array(['1016', '1017', '1019', '663', '673', '678', '686', '687', '688',
       '690', '728', '730', '734', '744', '745', '746', '750', '754',
       '782', '783', '785', '786', '985', '986', '991'], dtype=object)
[24]:
print(len(dyn['OBJECTID'].unique()))
25
[25]:
print(cat.shape)
(6300, 112)
[26]:
df = pd.concat([grp['median_C_TN'] for idx,grp in dyn.groupby('OBJECTID')], axis=1)
df.columns = dyn['OBJECTID'].unique()
ridge(df, figsize=(10, 10), color="GnBu", title="median_C_TN")
../_images/auto_examples_quadica_32_0.svg
[26]:
[<Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >]

monthly TP

[27]:
dyn, cat = dataset.fetch_monthly(parameters="TP", max_nan_tol=0)
print(dyn.shape)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:144: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  wrtds.index = pd.to_datetime(wrtds['Year'].astype(str) + ' ' + wrtds['Month'].astype(str))
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:303: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  temp.index = pd.to_datetime(temp.index)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:350: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pcp.index = pd.to_datetime(pcp.index)
(21420, 9)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:254: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pet.index = pd.to_datetime(pet.index)
[28]:
dyn['OBJECTID'].unique()
[28]:
array(['1016', '1017', '1019', '1082', '1113', '1186', '1271', '1275',
       '1570', '1571', '1573', '1677', '1678', '1680', '1683', '334',
       '335', '336', '337', '340', '341', '342', '345', '347', '350',
       '352', '355', '358', '359', '360', '362', '363', '364', '365',
       '368', '370', '374', '376', '380', '381', '391', '663', '673',
       '678', '686', '687', '688', '690', '692', '696', '701', '705',
       '711', '716', '718', '722', '723', '728', '730', '734', '735',
       '736', '737', '739', '740', '742', '744', '745', '746', '750',
       '754', '769', '773', '776', '778', '782', '783', '785', '786',
       '874', '885', '899', '985', '986', '991'], dtype=object)
[29]:
print(len(dyn['OBJECTID'].unique()))
85
[30]:
[30]:
median_Q median_FNC_TP mean_Flux_TP mean_FNFlux_TP median_C_TP OBJECTID avg_temp precip pet
1993-01-01 26.830 0.264840 708.978059 729.450441 0.250841 1016 3.522219 87.729192 13.233763
1993-02-01 14.915 0.252750 371.334647 598.592187 0.276256 1016 -0.751842 17.499132 11.923154
1993-03-01 10.550 0.259186 292.704292 540.657572 0.317533 1016 4.395708 9.086743 46.873238
1993-04-01 10.090 0.288951 305.748890 435.010108 0.340756 1016 10.420328 34.628064 82.216114
1993-05-01 10.480 0.336200 361.870561 403.209077 0.359759 1016 13.843144 100.724108 112.228591
[31]:
[31]:
median_Q median_FNC_TP mean_Flux_TP mean_FNFlux_TP median_C_TP OBJECTID avg_temp precip pet
2013-08-01 2.70 0.115998 24.963891 41.111437 0.106069 991 17.427514 46.309400 112.389357
2013-09-01 2.55 0.111201 23.158398 39.240604 0.101192 991 13.039871 71.339231 59.626034
2013-10-01 3.42 0.114864 32.025155 47.904513 0.111296 991 11.067293 78.249183 31.262571
2013-11-01 4.77 0.129910 57.209615 73.404061 0.126029 991 5.443935 63.361708 11.133313
2013-12-01 7.43 0.144230 96.120649 110.040862 0.143431 991 4.831621 71.560471 7.538275
[32]:
print(dyn.isna().sum())
median_Q          0
median_FNC_TP     0
mean_Flux_TP      0
mean_FNFlux_TP    0
median_C_TP       0
OBJECTID          0
avg_temp          0
precip            0
pet               0
dtype: int64
[33]:
print(cat.shape)
(21420, 112)

monthly TOC

[34]:
dyn, cat = dataset.fetch_monthly(parameters="TOC", max_nan_tol=0)
print(dyn.shape)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:144: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  wrtds.index = pd.to_datetime(wrtds['Year'].astype(str) + ' ' + wrtds['Month'].astype(str))
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:303: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  temp.index = pd.to_datetime(temp.index)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:350: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pcp.index = pd.to_datetime(pcp.index)
(5796, 9)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:254: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pet.index = pd.to_datetime(pet.index)
[35]:
dyn['OBJECTID'].unique()
[35]:
array(['1016', '1019', '1473', '1482', '1570', '1571', '1573', '1677',
       '1678', '1680', '1683', '1688', '1690', '352', '355', '358', '359',
       '370', '374', '796', '797', '985', '991'], dtype=object)
[36]:
print(len(dyn['OBJECTID'].unique()))

grouper = dyn.groupby("OBJECTID")



fig, axes = create_subplots(grouper.ngroups, figsize=(12, 10))
for (idx, grp), ax in zip(grouper, axes.flat):
    hist(grp['median_C_TOC'], ax=ax, show=False, ax_kws=dict(title=idx))
plt.show()
23
../_images/auto_examples_quadica_44_1.svg
[37]:
df = pd.concat([grp['median_C_TOC'] for idx,grp in dyn.groupby('OBJECTID')], axis=1)
df.columns = dyn['OBJECTID'].unique()

ridge(df, figsize=(10, 10), color="GnBu", title="median_C_TOC")
../_images/auto_examples_quadica_45_0.svg
[37]:
[<Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >,
 <Axes: >]
[38]:
[38]:
median_FNC_TOC median_Q mean_Flux_TOC median_C_TOC mean_FNFlux_TOC OBJECTID avg_temp precip pet
1993-01-01 4.369830 26.830 13574.522004 4.212516 14157.612115 1016 3.522219 87.729192 13.233763
1993-02-01 4.062978 14.915 5151.380413 3.728177 11312.971228 1016 -0.751842 17.499132 11.923154
1993-03-01 4.044296 10.550 3485.207419 3.728456 9943.530417 1016 4.395708 9.086743 46.873238
1993-04-01 4.197412 10.090 3646.801855 4.031031 6998.987771 1016 10.420328 34.628064 82.216114
1993-05-01 4.478295 10.480 4845.934057 4.421674 6128.825892 1016 13.843144 100.724108 112.228591
[39]:
[39]:
median_FNC_TOC median_Q mean_Flux_TOC median_C_TOC mean_FNFlux_TOC OBJECTID avg_temp precip pet
2013-08-01 9.780485 2.70 2051.167867 8.657503 3631.592594 991 17.427514 46.309400 112.389357
2013-09-01 10.124471 2.55 1987.743880 8.610587 3782.986075 991 13.039871 71.339231 59.626034
2013-10-01 11.019640 3.42 2995.745601 10.367034 4882.642291 991 11.067293 78.249183 31.262571
2013-11-01 12.917707 4.77 5698.008879 12.272105 7789.730463 991 5.443935 63.361708 11.133313
2013-12-01 13.924602 7.43 9682.088520 14.007187 11295.747400 991 4.831621 71.560471 7.538275
[40]:
print(dyn.isna().sum())
median_FNC_TOC     0
median_Q           0
mean_Flux_TOC      0
median_C_TOC       0
mean_FNFlux_TOC    0
OBJECTID           0
avg_temp           0
precip             0
pet                0
dtype: int64
[41]:
print(cat.shape)
(5796, 112)

monthly DOC

[42]:
dyn, cat = dataset.fetch_monthly(parameters="DOC", max_nan_tol=0)
print(dyn.shape)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:144: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  wrtds.index = pd.to_datetime(wrtds['Year'].astype(str) + ' ' + wrtds['Month'].astype(str))
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:303: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  temp.index = pd.to_datetime(temp.index)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:350: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pcp.index = pd.to_datetime(pcp.index)
(6804, 9)
/home/docs/checkouts/readthedocs.org/user_builds/water-datasets/checkouts/latest/aqua_fetch/wq/_quadica.py:254: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  pet.index = pd.to_datetime(pet.index)
[43]:
dyn['OBJECTID'].unique()
[43]:
array(['1016', '1017', '1019', '1082', '1271', '663', '678', '690', '696',
       '701', '705', '711', '718', '722', '723', '728', '734', '744',
       '745', '746', '750', '754', '776', '782', '783', '785', '786'],
      dtype=object)
[44]:
print(len(dyn['OBJECTID'].unique()))
27
[45]:
[45]:
median_FNC_DOC median_Q mean_Flux_DOC mean_FNFlux_DOC median_C_DOC OBJECTID avg_temp precip pet
1993-01-01 4.422908 26.830 14034.419176 14746.595522 4.263823 1016 3.522219 87.729192 13.233763
1993-02-01 4.151962 14.915 5267.981150 11863.883605 3.819951 1016 -0.751842 17.499132 11.923154
1993-03-01 4.057110 10.550 3433.955020 10704.012637 3.688297 1016 4.395708 9.086743 46.873238
1993-04-01 4.038146 10.090 3461.362674 6688.173272 3.828360 1016 10.420328 34.628064 82.216114
1993-05-01 4.142562 10.480 4471.200985 5564.030457 4.057443 1016 13.843144 100.724108 112.228591
[46]:
[46]:
median_FNC_DOC median_Q mean_Flux_DOC mean_FNFlux_DOC median_C_DOC OBJECTID avg_temp precip pet
2013-08-01 3.185052 3.0620 695.156677 1104.605608 2.557519 786 17.966228 39.341122 118.449632
2013-09-01 3.222788 3.3355 767.811400 1160.244409 2.661074 786 13.281095 66.205910 59.288903
2013-10-01 3.185955 3.7390 1096.453981 1197.565692 2.836283 786 11.044072 77.306382 33.423185
2013-11-01 3.527299 3.7710 1097.124559 1493.351442 2.764579 786 5.263868 62.294622 12.376870
2013-12-01 3.935583 3.9930 1329.661671 1920.445979 2.826071 786 4.765950 58.713828 8.326679
[47]:
print(dyn.isna().sum())
median_FNC_DOC     0
median_Q           0
mean_Flux_DOC      0
mean_FNFlux_DOC    0
median_C_DOC       0
OBJECTID           0
avg_temp           0
precip             0
pet                0
dtype: int64
[48]:
print(cat.shape)
(6804, 112)