diff --git a/examples/data/landsat_era5_sample.tif b/examples/data/landsat_era5_sample.tif index b06db88..85babbc 100644 Binary files a/examples/data/landsat_era5_sample.tif and b/examples/data/landsat_era5_sample.tif differ diff --git a/examples/notebooks/01_geeet.ipynb b/examples/notebooks/01_geeet.ipynb index 25d93fc..068b864 100644 --- a/examples/notebooks/01_geeet.ipynb +++ b/examples/notebooks/01_geeet.ipynb @@ -33,7 +33,7 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 1, "id": "e21eda87", "metadata": {}, "outputs": [ @@ -42,15 +42,15 @@ "output_type": "stream", "text": [ "Energy balance components et_list et_np\n", - "Net radiation (W/m²): [524.5 104.5] | [524.5 104.5]\n", - "Net radiation (W/m²) from canopy source: [366.7 73.1] | [366.7 73.1]\n", - "Net radiation (W/m²) from soil source: [157.8 31.4] | [157.8 31.4]\n", - "Latent heat flux (W/m²): [405.5 88.5] | [405.5 88.5]\n", - "Latent heat flux (W/m²) from canopy source: [320.1 63.3] | [320.1 63.3]\n", - "Latent heat flux (W/m²) from soil source: [85.4 25.2] | [85.4 25.2]\n", - "Sensible heat flux (W/m²) from canopy source: [46.7 9.8] | [46.7 9.8]\n", - "Sensible heat flux (W/m²) from soil source: [28.5 -2.5] | [28.5 -2.5]\n", - "Ground heat flux (W/m²): [43.9 8.7] | [43.9 8.7]\n" + "Net radiation (W/m²): [574.5 104.5] | [574.5 104.5]\n", + "Net radiation (W/m²) from canopy source: [401.7 73.1] | [401.7 73.1]\n", + "Net radiation (W/m²) from soil source: [172.8 31.4] | [172.8 31.4]\n", + "Latent heat flux (W/m²): [336.5 77.9] | [336.5 77.9]\n", + "Latent heat flux (W/m²) from canopy source: [310.5 56. ] | [310.5 56. ]\n", + "Latent heat flux (W/m²) from soil source: [26. 21.8] | [26. 21.8]\n", + "Sensible heat flux (W/m²) from canopy source: [91.2 17. ] | [91.2 17. ]\n", + "Sensible heat flux (W/m²) from soil source: [98.7 0.9] | [98.7 0.9]\n", + "Ground heat flux (W/m²): [48.1 8.7] | [48.1 8.7]\n" ] } ], @@ -63,10 +63,11 @@ " Alb = [0.2, 0.2], # Albedo (-)\n", " NDVI = [0.8, 0.8], # NDVI (-)\n", " P = [95500, 95500], # Surface pressure (Pa)\n", - " Ta = [293, 293], # Air temperature (K)\n", + " Ta = [290, 290], # Air temperature (K)\n", + " Td = [287, 287], # Dewpoint temperature (K)\n", " U = [5,5], # Wind speed (m/s)\n", " Sdn = [800, 400], # Shortwave downward radiation (W/m²)\n", - " Ldn = [300, 200] # Longwave downward radiation (W/m²)\n", + " Ldn = [350, 200] # Longwave downward radiation (W/m²)\n", ")\n", "np_inputs = {key:np.array(value) for key,value in list_inputs.items()}\n", "\n", @@ -111,7 +112,7 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": 2, "id": "005eea64", "metadata": {}, "outputs": [ @@ -481,45 +482,45 @@ " stroke: currentColor;\n", " fill: currentColor;\n", "}\n", - "
<xarray.Dataset> Size: 384B\n",
+       "
<xarray.Dataset> Size: 400B\n",
        "Dimensions:                  (dim_0: 2)\n",
        "Dimensions without coordinates: dim_0\n",
-       "Data variables: (12/24)\n",
+       "Data variables: (12/25)\n",
        "    albedo                   (dim_0) float64 16B 0.2 0.2\n",
        "    NDVI                     (dim_0) float64 16B 0.8 0.8\n",
        "    radiometric_temperature  (dim_0) int64 16B 295 295\n",
-       "    air_temperature          (dim_0) int64 16B 293 293\n",
+       "    air_temperature          (dim_0) int64 16B 290 290\n",
+       "    dewpoint_temperature     (dim_0) int64 16B 287 287\n",
        "    surface_pressure         (dim_0) int64 16B 95500 95500\n",
-       "    wind_speed               (dim_0) int64 16B 5 5\n",
        "    ...                       ...\n",
-       "    Tc                       (dim_0) float64 16B 294.7 295.2\n",
-       "    Tac                      (dim_0) float64 16B 296.0 294.5\n",
+       "    Tc                       (dim_0) float64 16B 293.2 295.1\n",
+       "    Tac                      (dim_0) float64 16B 300.3 294.8\n",
        "    ra                       (dim_0) float64 16B 40.87 297.9\n",
        "    rs                       (dim_0) float64 16B 79.94 192.4\n",
        "    rx                       (dim_0) float64 16B 11.68 31.11\n",
-       "    it                       (dim_0) float64 16B 0.0 2.0
" + " it (dim_0) float64 16B 0.0 2.0
" ], "text/plain": [ - " Size: 384B\n", + " Size: 400B\n", "Dimensions: (dim_0: 2)\n", "Dimensions without coordinates: dim_0\n", - "Data variables: (12/24)\n", + "Data variables: (12/25)\n", " albedo (dim_0) float64 16B 0.2 0.2\n", " NDVI (dim_0) float64 16B 0.8 0.8\n", " radiometric_temperature (dim_0) int64 16B 295 295\n", - " air_temperature (dim_0) int64 16B 293 293\n", + " air_temperature (dim_0) int64 16B 290 290\n", + " dewpoint_temperature (dim_0) int64 16B 287 287\n", " surface_pressure (dim_0) int64 16B 95500 95500\n", - " wind_speed (dim_0) int64 16B 5 5\n", " ... ...\n", - " Tc (dim_0) float64 16B 294.7 295.2\n", - " Tac (dim_0) float64 16B 296.0 294.5\n", + " Tc (dim_0) float64 16B 293.2 295.1\n", + " Tac (dim_0) float64 16B 300.3 294.8\n", " ra (dim_0) float64 16B 40.87 297.9\n", " rs (dim_0) float64 16B 79.94 192.4\n", " rx (dim_0) float64 16B 11.68 31.11\n", " it (dim_0) float64 16B 0.0 2.0" ] }, - "execution_count": 71, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -527,17 +528,21 @@ "source": [ "import xarray as xr\n", "\n", - "xr_inputs = xr.merge([\n", - " xr.DataArray(list_inputs[\"Alb\"]).rename(\"albedo\"),\n", - " xr.DataArray(list_inputs[\"NDVI\"]).rename(\"NDVI\"),\n", - " xr.DataArray(list_inputs[\"Tr\"]).rename(\"radiometric_temperature\"),\n", - " xr.DataArray(list_inputs[\"Ta\"]).rename(\"air_temperature\"),\n", - " xr.DataArray(list_inputs[\"P\"]).rename(\"surface_pressure\"),\n", - " xr.DataArray(list_inputs[\"U\"]).rename(\"wind_speed\"),\n", - " xr.DataArray(list_inputs[\"Sdn\"]).rename(\"solar_radiation\"),\n", - " xr.DataArray(list_inputs[\"Ldn\"]).rename(\"thermal_radiation\"),\n", - " ])\n", - " \n", + "band_names = {\n", + " \"Alb\": \"albedo\",\n", + " \"NDVI\":\"NDVI\",\n", + " \"Tr\":\"radiometric_temperature\",\n", + " \"Ta\":\"air_temperature\",\n", + " \"Td\":\"dewpoint_temperature\",\n", + " \"P\":\"surface_pressure\",\n", + " \"U\":\"wind_speed\",\n", + " \"Sdn\":\"solar_radiation\",\n", + " \"Ldn\":\"thermal_radiation\",\n", + "}\n", + " \n", + "xr_inputs = xr.merge(\n", + " [xr.DataArray(list_inputs[k]).rename(v) for k,v in band_names.items()])\n", + "\n", "et_xr = geeet.tseb.tseb_series(xr_inputs, **scalar_inputs)\n", "et_xr" ] @@ -562,7 +567,7 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 3, "id": "bbfdd475", "metadata": {}, "outputs": [], @@ -582,10 +587,11 @@ " ee_images.append(\n", " ee.Image(ee.Dictionary(x).toImage())\n", " # Rename (same names as in the xarray example)\n", - " .select([\"Alb\", \"NDVI\", \"Tr\", \"Ta\", \"P\", \"U\", \"Sdn\", \"Ldn\"],\n", + " .select([\"Alb\", \"NDVI\", \"Tr\", \"Td\",\"Ta\", \"P\", \"U\", \"Sdn\", \"Ldn\"],\n", " [\"albedo\",\n", " \"NDVI\",\n", " \"radiometric_temperature\",\n", + " \"dewpoint_temperature\",\n", " \"air_temperature\",\n", " \"surface_pressure\",\n", " \"wind_speed\",\n", @@ -608,7 +614,7 @@ }, { "cell_type": "code", - "execution_count": 73, + "execution_count": 4, "id": "88bf21ca", "metadata": {}, "outputs": [], @@ -626,7 +632,7 @@ }, { "cell_type": "code", - "execution_count": 74, + "execution_count": 5, "id": "87243731", "metadata": {}, "outputs": [ @@ -636,6 +642,7 @@ "['albedo',\n", " 'NDVI',\n", " 'radiometric_temperature',\n", + " 'dewpoint_temperature',\n", " 'air_temperature',\n", " 'surface_pressure',\n", " 'wind_speed',\n", @@ -662,7 +669,7 @@ " 'Rnc']" ] }, - "execution_count": 74, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -681,7 +688,7 @@ }, { "cell_type": "code", - "execution_count": 75, + "execution_count": 6, "id": "70843dab", "metadata": {}, "outputs": [], @@ -706,7 +713,7 @@ }, { "cell_type": "code", - "execution_count": 76, + "execution_count": 7, "id": "9c83d1ee", "metadata": {}, "outputs": [ @@ -714,15 +721,15 @@ "name": "stdout", "output_type": "stream", "text": [ - "Net radiation (W/m²): 524.52 | 524.52\n", - "Net radiation (W/m²) from canopy source: 366.72 | 366.72\n", - "Net radiation (W/m²) from soil source: 157.80 | 157.80\n", - "Latent heat flux (W/m²): 405.50 | 405.50\n", - "Latent heat flux (W/m²) from canopy source: 320.06 | 320.06\n", - "Latent heat flux (W/m²) from soil source: 85.44 | 85.44\n", - "Sensible heat flux (W/m²) from canopy source: 46.65 | 46.65\n", - "Sensible heat flux (W/m²) from soil source: 28.45 | 28.45\n", - "Ground heat flux (W/m²): 43.91 | 43.91\n" + "Net radiation (W/m²): 574.52 | 574.52\n", + "Net radiation (W/m²) from canopy source: 401.67 | 401.67\n", + "Net radiation (W/m²) from soil source: 172.85 | 172.85\n", + "Latent heat flux (W/m²): 336.52 | 336.52\n", + "Latent heat flux (W/m²) from canopy source: 310.48 | 310.48\n", + "Latent heat flux (W/m²) from soil source: 26.04 | 26.04\n", + "Sensible heat flux (W/m²) from canopy source: 91.19 | 91.19\n", + "Sensible heat flux (W/m²) from soil source: 98.71 | 98.71\n", + "Ground heat flux (W/m²): 48.10 | 48.10\n" ] } ], @@ -753,7 +760,7 @@ }, { "cell_type": "code", - "execution_count": 77, + "execution_count": 8, "id": "7f1d2a0f", "metadata": {}, "outputs": [], @@ -775,7 +782,7 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": 9, "id": "0f3cbd16", "metadata": {}, "outputs": [], @@ -797,7 +804,7 @@ }, { "cell_type": "code", - "execution_count": 81, + "execution_count": 10, "id": "1a06d81d", "metadata": {}, "outputs": [ @@ -806,15 +813,15 @@ "output_type": "stream", "text": [ "Energy balance components np_outputs ee_outputs\n", - "Net radiation (W/m²): [524.5 104.5] | [524.5 104.5]\n", - "Net radiation (W/m²) from canopy source: [366.7 73.1] | [366.7 73.1]\n", - "Net radiation (W/m²) from soil source: [157.8 31.4] | [157.8 31.4]\n", - "Latent heat flux (W/m²): [405.5 88.5] | [405.5 88.5]\n", - "Latent heat flux (W/m²) from canopy source: [320.1 63.3] | [320.1 63.3]\n", - "Latent heat flux (W/m²) from soil source: [85.4 25.2] | [85.4 25.2]\n", - "Sensible heat flux (W/m²) from canopy source: [46.7 9.8] | [46.7 9.8]\n", - "Sensible heat flux (W/m²) from soil source: [28.5 -2.5] | [28.5 -2.5]\n", - "Ground heat flux (W/m²): [43.9 8.7] | [43.9 8.7]\n" + "Net radiation (W/m²): [574.5 104.5] | [574.5 104.5]\n", + "Net radiation (W/m²) from canopy source: [401.7 73.1] | [401.7 73.1]\n", + "Net radiation (W/m²) from soil source: [172.8 31.4] | [172.8 31.4]\n", + "Latent heat flux (W/m²): [336.5 77.9] | [336.5 77.9]\n", + "Latent heat flux (W/m²) from canopy source: [310.5 56. ] | [310.5 56. ]\n", + "Latent heat flux (W/m²) from soil source: [26. 21.8] | [26. 21.8]\n", + "Sensible heat flux (W/m²) from canopy source: [91.2 17. ] | [91.2 17. ]\n", + "Sensible heat flux (W/m²) from soil source: [98.7 0.9] | [98.7 0.9]\n", + "Ground heat flux (W/m²): [48.1 8.7] | [48.1 8.7]\n" ] } ], @@ -869,7 +876,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.12.2" } }, "nbformat": 4, diff --git a/examples/notebooks/02_demo_using_GEE_data.ipynb b/examples/notebooks/02_demo_using_GEE_data.ipynb index 47e8dc2..b27a694 100644 --- a/examples/notebooks/02_demo_using_GEE_data.ipynb +++ b/examples/notebooks/02_demo_using_GEE_data.ipynb @@ -87,7 +87,7 @@ " DT = img.select('dewpoint_temperature') # in Kelvin\n", " P = img.select('surface_pressure') # in Pascals\n", " from geeet.meteo import relative_humidity # eq 7.91 in ECMWF (2016)\n", - " RH = relative_humidity(T, DT, P) \n", + " RH = relative_humidity(T, DT) \n", " img = img.addBands(Rn).addBands(RH)\n", " return(img)\n", "\n", @@ -321,7 +321,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.12.2" } }, "nbformat": 4, diff --git a/examples/notebooks/03_eepredefined_landsat_era5.ipynb b/examples/notebooks/03_eepredefined_landsat_era5.ipynb index be13ab6..2857d9f 100644 --- a/examples/notebooks/03_eepredefined_landsat_era5.ipynb +++ b/examples/notebooks/03_eepredefined_landsat_era5.ipynb @@ -17,7 +17,7 @@ "\n", "---\n", "\n", - "The `geeet.eepredefined` library contains a collection of modules used to make it easy to ingest GEE data into the geeet models. \n", + "The `geeet.eepredefined` library contains a collection of modules that make it easy to ingest GEE data into the geeet models. \n", "\n", "This notebook demonstrates how to:\n", "\n", @@ -226,7 +226,7 @@ "\n", "Let's generate a small visualization by clipping one of the images to a small region. \n", "\n", - "> You will need [geemap](geemap.org) for this visualization. Alternatively, open [this script in the code editor](https://code.earthengine.google.com/628832ffbd371d828a048e9de2f0903d). " + "> You will need [geemap](geemap.org) for this visualization. Alternatively, open [this script in the code editor](https://code.earthengine.google.com/f71913e4516d36de0da2c0bce4f03d39). " ] }, { @@ -262,7 +262,7 @@ "Map.addLayer(image.select('NDVI'), {'min':0, 'max':1, 'palette':ndvi_pal, 'opacity': 0.8}, 'NDVI')\n", "Map.addLayer(image.select('radiometric_temperature'), {'min':20+273, 'max':50+273, 'palette':red_pal}, 'Landsat radiometric temperature (K)')\n", "Map.addLayer(image.select('Rn'), {'min':0, 'max':500, 'palette':red_pal}, 'Net radiation (W/m²)', False)\n", - "Map.addLayer(image.select('LEc'), {'min':0, 'max':500, 'palette':blue_pal}, 'Latent heat flux (W/m²) from the canopy source', True)\n", + "Map.addLayer(image.select('LEc'), {'min':0, 'max':300, 'palette':blue_pal}, 'Latent heat flux (W/m²) from the canopy source', True)\n", "\n", "Map" ] @@ -273,7 +273,7 @@ "source": [ "Here's a preview of how the map should look like:\n", "\n", - "![image](https://github.com/kaust-halo/geeet/assets/14804652/30aad357-5ced-4420-b264-7b935c9fd171)" + "![image](https://github.com/kaust-halo/geeet/assets/14804652/8379c468-1264-47ff-bdfb-89a7f9d8f61b)" ] }, { @@ -308,7 +308,7 @@ " crs=\"EPSG:32637\",\n", " crsTransform=[30,0,296685,0,-30,3470115],\n", " )\n", - "task.start() # Uncomment to submit the task." + "#task.start() # Uncomment to submit the task." ] } ], @@ -333,7 +333,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.12.2" }, "widgets": { "application/vnd.jupyter.widget-state+json": { diff --git a/examples/notebooks/04_eepredefined_landsat_mapped_collection.ipynb b/examples/notebooks/04_eepredefined_landsat_mapped_collection.ipynb index bd6e831..05dc0c0 100644 --- a/examples/notebooks/04_eepredefined_landsat_mapped_collection.ipynb +++ b/examples/notebooks/04_eepredefined_landsat_mapped_collection.ipynb @@ -98,6 +98,7 @@ " 'cloud_cover',\n", " 'surface_pressure',\n", " 'air_temperature',\n", + " 'dewpoint_temperature',\n", " 'u_component_of_wind_10m',\n", " 'v_component_of_wind_10m',\n", " 'surface_solar_radiation_downwards_hourly',\n", @@ -160,7 +161,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.12.2" } }, "nbformat": 4, diff --git a/examples/notebooks/05_xarray_landsat_era5.ipynb b/examples/notebooks/05_xarray_landsat_era5.ipynb index dd7cbbc..dcce5e2 100644 --- a/examples/notebooks/05_xarray_landsat_era5.ipynb +++ b/examples/notebooks/05_xarray_landsat_era5.ipynb @@ -54,8 +54,8 @@ "metadata": {}, "outputs": [], "source": [ - "inputs = data[[\"NDVI\", \"albedo\", \"radiometric_temperature\", \n", - "\"surface_pressure\", \"air_temperature\", \"wind_speed\", \"solar_radiation\", \"thermal_radiation\"]]\n", + "inputs = data[[\"NDVI\", \"albedo\", \"radiometric_temperature\", \n", + "\"surface_pressure\", \"air_temperature\", \"dewpoint_temperature\", \"wind_speed\", \"solar_radiation\", \"thermal_radiation\"]]\n", "inputs" ] }, @@ -178,8 +178,8 @@ "inputsb = (datab[[\n", " \"longitude\", \"latitude\",\n", " \"NDVI\", \"albedo\", \"radiometric_temperature\", \n", - " \"surface_pressure\", \"air_temperature\", \"wind_speed\", \n", - " \"solar_radiation\", \"thermal_radiation\"]]\n", + " \"surface_pressure\", \"air_temperature\", \"dewpoint_temperature\",\n", + " \"wind_speed\", \"solar_radiation\", \"thermal_radiation\"]]\n", ")\n", "\n", "xetb = geeet.tseb.tseb_series(inputsb, **dict(\n", @@ -219,7 +219,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.12.2" } }, "nbformat": 4, diff --git a/geeet/ptjpl.py b/geeet/ptjpl.py index 8ae533d..c3e62be 100644 --- a/geeet/ptjpl.py +++ b/geeet/ptjpl.py @@ -123,6 +123,7 @@ def ptjpl_arid(img=None, # ee.Image with inputs as bands (takes precedence over band_names = img.bandNames() NDVI = img.select('NDVI') Ta = img.select('air_temperature') + Td = img.select('dewpoint_temperature') P = img.select('surface_pressure') F_aparmax = img.select('fapar_max') time = img.get('time') @@ -154,7 +155,7 @@ def ptjpl_arid(img=None, # ee.Image with inputs as bands (takes precedence over ft = compute_ft_arid(Ta) f_apar = compute_fapar(NDVI) fm = compute_fm(f_apar, F_aparmax) - met_params = compute_met_params(Ta, P) + met_params = compute_met_params(Ta, Td, P) fsm = compute_fsm(RH, Ta, Beta) if is_img(img): diff --git a/geeet/resistances.py b/geeet/resistances.py index 84d0593..00ea617 100644 --- a/geeet/resistances.py +++ b/geeet/resistances.py @@ -7,7 +7,7 @@ def RN95(U, CH, rough_params, LAI, leaf_width, zU, zT, L=None, Ustar = None, rough_bands = ['ZM','ZH','D0'] , band_names = ['Ra', 'Rs', 'Rx']): """ Calculate the original TSEB resistances from Norman et al., 1995 (N95) -#//description + Inputs: - U: wind speed in m/s, numpy array or an ee.Image - CH: canopy height in m, numpy array or ee.Image @@ -98,7 +98,6 @@ def RN95(U, CH, rough_params, LAI, leaf_width, zU, zT, L=None, Ustar = None, rou where C1 ~ 90 s-1/2 m-1 s is the average leaf width Udzm is given by equation A.9 and is obtained after computing Uc (Equations B2-B4) -#//enddescription """ from geeet.MOST import PsiM as compute_psim from geeet.MOST import PsiH as compute_psih