[1]:
%matplotlib inline
Global River Water Quality
[2]:
import ai4water
from easy_mpl import plot
import matplotlib.pyplot as plt
from ai4water.datasets import GRQA
print(ai4water.__version__)
**********Tensorflow models could not be imported **********
1.06
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\sklearn\experimental\enable_hist_gradient_boosting.py:16: UserWarning: Since version 1.0, it is not needed to import enable_hist_gradient_boosting anymore. HistGradientBoostingClassifier and HistGradientBoostingRegressor are now stable and can be normally imported from sklearn.ensemble.
warnings.warn(
[3]:
ds = GRQA(path="F:\\data\\GRQA")
Not downloading the data since the directory
F:\data\GRQA already exists.
Use overwrite=True to remove previously saved files and download again
[4]:
print(ds.parameters)
['BOD5', 'BOD7', 'BOD', 'CODCr', 'CODMn', 'COD', 'DC', 'DIC', 'DIN', 'DIP', 'DKN', 'DOC', 'DON', 'DOP', 'DOSAT', 'DO', 'NH4N', 'NO2N', 'NO3N', 'PC', 'pH', 'PIC', 'PN', 'POC', 'PON', 'POP', 'TAN', 'TC', 'TDN', 'TDP', 'TEMP', 'TIC', 'TIN', 'TIP', 'TKN', 'TN', 'TOC', 'TON', 'TOP', 'TPP', 'TP', 'TSS']
[5]:
country = "Pakistan"
len(ds.fetch_parameter('TEMP', country=country))
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
[5]:
1324
[6]:
params = []
for param in ds.parameters:
if len(ds.fetch_parameter(param, country=country))>1:
params.append(param)
print(params)
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,10,13,18,29,30,31,32) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (29,31,32) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (29,31,32) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,10,11,23,29,30,31,32,33,34,35,36,37) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (6,11,18,29,30,31,32,33,34,35) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (6,11,29,30,31,32,33,34,35) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,10,11,13,18,23,29,30,31,32,33,36) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (6,11,18,23,29,30,31,32,33,34,35,36,37) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,22,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (11,13,18,29,30,31,32,33,34,35) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,29,30,31,32,33,34,35,36,37) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (11,13,18) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (11,13,18,29,30,31,32,33,34,35) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (6,11,30,31,32,33,34,35) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (6,11,18,23,29,30,31,32,33,34,35,36,37) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,10,11,13,18,23,29,30,31,32,33,34,35,36,38) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
['BOD', 'COD', 'DON', 'DOSAT', 'DO', 'NH4N', 'pH', 'TDP', 'TEMP', 'TKN', 'TP', 'TSS']
[7]:
df = ds.fetch_parameter("TEMP", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
(1324, 38)
[8]:
df = ds.fetch_parameter("NH4N", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (6,11,18,23,29,30,31,32,33,34,35,36,37) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
(28, 36)
[9]:
df = ds.fetch_parameter("DO", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
(1327, 38)
[10]:
df = ds.fetch_parameter("COD", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
(1317, 32)
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (29,31,32) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
[11]:
df = ds.fetch_parameter("BOD", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
(1326, 32)
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (29,31,32) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
[12]:
df = ds.fetch_parameter("DON", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,10,11,13,18,23,29,30,31,32,33,36) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
(123, 36)
[13]:
df = ds.fetch_parameter("DOSAT", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
(221, 38)
[14]:
df = ds.fetch_parameter("TDP", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
(92, 36)
[15]:
df = ds.fetch_parameter("TKN", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (6,11,18,23,29,30,31,32,33,34,35,36,37) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
(58, 36)
[16]:
df = ds.fetch_parameter("TSS", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
(1293, 38)
[17]:
df = ds.fetch_parameter("TP", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
(249, 38)
[18]:
df = ds.fetch_parameter("pH", country=country)
print(df.shape)
for grp_name, grp in df.groupby('site_name'):
plot(grp['obs_value'], '--.', label=grp_name, show=False,
ax_kws=dict(figsize=(18,7)))
plt.show()
D:\C\Anaconda3\envs\ai4w_dataset\lib\site-packages\ai4water\datasets\_grqa.py:119: DtypeWarning: Columns (5,6,10,11,13,18,22,23,29,30,31,32,33,34,35,36,37,38,39) have mixed types. Specify dtype option on import or set low_memory=False.
return pd.read_csv(fname, sep=";")
(1285, 38)