diff --git a/tethysapp/hydro_var_monitor/app.py b/tethysapp/hydro_var_monitor/app.py index 78e908b..4c497c6 100644 --- a/tethysapp/hydro_var_monitor/app.py +++ b/tethysapp/hydro_var_monitor/app.py @@ -7,11 +7,11 @@ class HydroVarMonitor(TethysAppBase): Tethys app class for Hydrologic Trends Monitor. """ - name = 'Hydrologic Variable Monitor' + name = 'Climate Trends' description = 'View maps and plots of hydrologic cycle variables recorded by satellites and global models' package = 'hydro_var_monitor' index = 'hydro_var_monitor:home' - icon = f'{package}/images/icon.gif' + icon = f'{package}/images/logo.gif' root_url = 'hydro-var-monitor' color = '#6DA8D9' tags = ['remote sensing', 'earth engine', 'hydrological cycle', 'essential water variables', 'geoglows toolbox'] diff --git a/tethysapp/hydro_var_monitor/controllers.py b/tethysapp/hydro_var_monitor/controllers.py index 037afb4..f73362c 100644 --- a/tethysapp/hydro_var_monitor/controllers.py +++ b/tethysapp/hydro_var_monitor/controllers.py @@ -10,7 +10,7 @@ from . import ee_auth import logging import os -from .ee_tools import ERA5, get_tile_url, GLDAS, CHIRPS, IMERG +from .ee_tools import ERA5, get_tile_url, GLDAS, CHIRPS, IMERG, GLDAS_evapo from .plots import plot_ERA5, plot_GLDAS, plot_IMERG, plot_CHIRPS from .compare import air_temp_compare, precip_compare @@ -22,10 +22,9 @@ def home(request): return render(request, 'hydro_var_monitor/no_auth_error.html') ee_sources = { 'air_temp': ['GLDAS', 'ERA5'], - 'ndvi': ['Landsat', ], 'precip': ['GLDAS', 'CHIRPS', 'IMERG', 'ERA5'], 'soil_moisture': ['GLDAS', ], - 'soil_temperature': ['ERA5', 'GLDAS'] + 'evapo': ['GLDAS'] } context = { 'sources': json.dumps(ee_sources) @@ -90,7 +89,7 @@ def get_map_id(request): "palette": ['009392', '72aaa1', 'b1c7b3', 'f1eac8', 'e5b9ad', 'd98994', 'd0587e']} if var == "precip": band = "total_precipitation" - vis_params = {"min": 0, "max": 0.03, "palette": ['00FFFF', '0000FF']} + vis_params = {"min": 0, "max": 0.008, "palette": ['00FFFF', '0000FF']} if var == "soil_temperature": band = "skin_temperature" vis_params = {"min": 250, "max": 300, @@ -101,28 +100,30 @@ def get_map_id(request): if sensor == "GLDAS": if var == "precip": band = "Rainf_tavg" - vis_params = {"min": 0, "max": 0.0002, "palette": ['00FFFF', '0000FF']} + vis_params = {"min": 0, "max": 0.00006, "palette": ['00FFFF', '0000FF']} + imgs = GLDAS(band) if var == "air_temp": band = "Tair_f_inst" - vis_params = {"min": 206, "max": 328, + vis_params = {"min": 235, "max": 320, "palette": ['009392', '72aaa1', 'b1c7b3', 'f1eac8', 'e5b9ad', 'd98994', 'd0587e']} + imgs = GLDAS(band) if var == "soil_moisture": band = "RootMoist_inst" - vis_params = {"min": 1.99, "max": 48, "palette": ['00FFFF', '0000FF']} - if var == "soil_temperature": - band = "AvgSurfT_inst" - vis_params = {"min": 222, "max": 378, - "palette": ['009392', '72aaa1', 'b1c7b3', 'f1eac8', 'e5b9ad', 'd98994', 'd0587e']} - imgs = GLDAS(band) + vis_params = {"min": 100, "max": 400} + imgs = GLDAS(band) + if var == "evapo": + band = "Evap_tavg" + vis_params = {"min":0, "max":0.00005} + imgs = GLDAS_evapo(band) if sensor == "IMERG": band = "HQprecipitation" - vis_params = {"min": 0, "max": 5, "palette": ['00FFFF', '0000FF']} + vis_params = {"min": 0, "max": 0.4, "palette": ['00FFFF', '0000FF']} imgs = IMERG(band) if sensor == "CHIRPS": band = "precipitation" - vis_params = {"min": 0, "max": 150, "palette": ['00FFFF', '0000FF']} + vis_params = {"min": 0, "max": 40, "palette": ['00FFFF', '0000FF']} imgs = CHIRPS(band) # get the url from specified image and then return it in json @@ -192,10 +193,10 @@ def get_plot(request): band = "RootMoist_inst" title = "Humedad del Suelo - GLDAS (root zone)" yaxis = "kg/m^2" - if var == "soil_temperature": - band = "AvgSurfT_inst" - title = "Temperatura del Suelo - GLDAS" - yaxis = "Temperatura en Celsius" + if var == "evapo": + band = "Evap_tavg" + title = "Evapotranspiración- GLDAS" + yaxis = "Evapotranspiración en kg/M^2/s" plot_data = plot_GLDAS(json.loads(region), band, title, yaxis, json.loads(isPoint), startDate, endDate) if sensor == "IMERG": @@ -282,10 +283,10 @@ def get_predefined(request): band = "RootMoist_inst" title = "Humedad del Suelo - GLDAS (root zone)" yaxis = "kg/m^2" - if var == "soil_temperature": - band = "AvgSurfT_inst" - title = "Temperatura del Suelo - GLDAS" - yaxis = "Temperatura en Celsius" + if var == "evapo": + band = "Evap_tavg" + title = "Evapotranspiración- GLDAS" + yaxis = "Evapotranspiración en kg/M^2/s" plot_data = plot_GLDAS(region, band, title, yaxis, json.loads(isPoint), startDate, endDate) if sensor == "IMERG": diff --git a/tethysapp/hydro_var_monitor/ee_tools.py b/tethysapp/hydro_var_monitor/ee_tools.py index 5e057f7..ab38c66 100644 --- a/tethysapp/hydro_var_monitor/ee_tools.py +++ b/tethysapp/hydro_var_monitor/ee_tools.py @@ -2,25 +2,35 @@ def ERA5(band): - ic = ee.ImageCollection("ECMWF/ERA5_LAND/MONTHLY").filterDate('1983-01-01', '2023-01-01').select(band).reduce( + ic = ee.ImageCollection( + [f'users/rachelshaylahuber55/era5_monthly_avg/era5_monthly_{i:02}' for i in range(1, 13)]).select(band).reduce( ee.Reducer.mean()) return ic def GLDAS(band): - ic = ee.ImageCollection("NASA/GLDAS/V021/NOAH/G025/T3H").filterDate('2022-01-01', '2023-01-01').select(band).reduce( + ic = ee.ImageCollection( + [f'users/rachelshaylahuber55/gldas_monthly/gldas_monthly_avg_{i:02}' for i in range(1, 13)]).select(band).reduce( + ee.Reducer.mean()) + return ic + +def GLDAS_evapo(band): + ic = ee.ImageCollection( + [f'users/rachelshaylahuber55/gldas_monthly/gldas_monthly_avg_evapo_{i:02}' for i in range(1, 13)]).select(band).reduce( ee.Reducer.mean()) return ic def IMERG(band): - ic = ee.ImageCollection("NASA/GPM_L3/IMERG_V06").filterDate('2022-07-01', '2023-01-01').select(band).reduce( + ic = ee.ImageCollection( + [f'users/rachelshaylahuber55/imerg_monthly_avg/imerg_monthly_avg_{i:02}' for i in range(1, 13)]).select(band).reduce( ee.Reducer.mean()) return ic def CHIRPS(band): - ic = ee.ImageCollection("UCSB-CHG/CHIRPS/PENTAD").filterDate('2022-01-01', '2023-01-01').select(band).reduce( + ic = ee.ImageCollection( + [f'users/rachelshaylahuber55/chirps_monthly_avg/chirps_monthly_avg_{i:02}' for i in range(1, 13)]).select(band).reduce( ee.Reducer.mean()) return ic diff --git a/tethysapp/hydro_var_monitor/plots.py b/tethysapp/hydro_var_monitor/plots.py index eecccab..4821f71 100644 --- a/tethysapp/hydro_var_monitor/plots.py +++ b/tethysapp/hydro_var_monitor/plots.py @@ -109,8 +109,12 @@ def avg_gldas(img): )) # read in assets from the gldas_monthly folder - gldas_monthly = ee.ImageCollection( - [f'users/rachelshaylahuber55/gldas_monthly/gldas_monthly_avg_{i:02}' for i in range(1, 13)]) + if band == "Evap_tavg": + gldas_monthly = ee.ImageCollection( + [f'users/rachelshaylahuber55/gldas_monthly/gldas_monthly_avg_evapo_{i:02}' for i in range(1, 13)]) + else: + gldas_monthly = ee.ImageCollection( + [f'users/rachelshaylahuber55/gldas_monthly/gldas_monthly_avg_{i:02}' for i in range(1, 13)]) gldas_monthly = gldas_monthly.map(avg_gldas) gldas_avg_df = pd.DataFrame( gldas_monthly.aggregate_array('avg_value').getInfo(), diff --git a/tethysapp/hydro_var_monitor/public/images/logo.gif b/tethysapp/hydro_var_monitor/public/images/logo.gif new file mode 100644 index 0000000..658d1c7 Binary files /dev/null and b/tethysapp/hydro_var_monitor/public/images/logo.gif differ diff --git a/tethysapp/hydro_var_monitor/templates/hydro_var_monitor/home.html b/tethysapp/hydro_var_monitor/templates/hydro_var_monitor/home.html index 334f31c..8db4453 100644 --- a/tethysapp/hydro_var_monitor/templates/hydro_var_monitor/home.html +++ b/tethysapp/hydro_var_monitor/templates/hydro_var_monitor/home.html @@ -7,13 +7,14 @@ {% block app_navigation_items %} - +