Skip to content

Commit

Permalink
Merge pull request #5 from guzman2319/tech-team-meeting-updates
Browse files Browse the repository at this point in the history
Tech team meeting updates
  • Loading branch information
cgmorton authored Nov 30, 2019
2 parents 27e3a44 + 6a3307f commit 217589a
Show file tree
Hide file tree
Showing 16 changed files with 739 additions and 383 deletions.
34 changes: 17 additions & 17 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ end_date
geometry
ee.Geometry() that is passed to the collection .filterBounds() calls.
All images with a footprint that intersects the geometry will be included.
etr_source
Reference ET source collection ID.
etr_band
et_reference_source
Reference ET source collection ID (see `Reference ET Sources`_).
et_reference_band
Reference ET source band name.

Optional Inputs
Expand Down Expand Up @@ -96,18 +96,19 @@ Collection Examples
start_date='2017-06-01',
end_date='2017-09-01',
geometry=ee.Geometry.Point(-121.5265, 38.7399),
etr_source='IDAHO_EPSCOR/GRIDMET',
etr_band='etr') \
.overpass(variables=['et', 'etr', 'etf'])
et_reference_source='IDAHO_EPSCOR/GRIDMET',
et_reference_band='eto') \
.overpass(variables=['et', 'et_reference', 'et_fraction'])
monthly_coll = model.Collection(
collections=['LANDSAT/LC08/C01/T1_SR'],
start_date='2017-06-01',
end_date='2017-09-01',
geometry=ee.Geometry.Point(-121.5265, 38.7399),
etr_source='IDAHO_EPSCOR/GRIDMET',
etr_band='etr') \
.interpolate(variables=['et', 'etr', 'etf'] t_interval='monthly')
et_reference_source='IDAHO_EPSCOR/GRIDMET',
et_reference_band='eto') \
.interpolate(variables=['et', 'et_reference', 'et_fraction']
t_interval='monthly')
Image
=====
Expand Down Expand Up @@ -152,9 +153,10 @@ Image Example
.. code-block:: python
import openet.sims as model
landsat_img = ee.Image('LANDSAT/LC08/C01/T1_SR/LC08_044033_20170716')
et_img = model.Image.from_landsat_c1_sr(
landsat_img, etr_source='IDAHO_EPSCOR/GRIDMET', etr_band='etr).et
ee.Image('LANDSAT/LC08/C01/T1_SR/LC08_044033_20170716'),
et_reference_source='IDAHO_EPSCOR/GRIDMET',
et_reference_band='eto').et
Variables
=========
Expand All @@ -163,10 +165,10 @@ The SIMS model can compute the following variables:

ndvi
Normalized difference vegetation index [unitless]
etf
et_fraction
Fraction of reference ET [unitless]
etr
Reference ET (alfalfa) [mm]
et_reference
Reference ET [mm] (type will depend on `Reference ET`_ parameters)
et
Actual ET [mm]

Expand All @@ -175,7 +177,7 @@ There is also a more general "calculate" method that can be used to return a mul
Reference ET
============

The reference ET data source is controlled using the "etr_source" and "etr_band" parameters.
The reference ET data source is controlled using the "et_reference_source" and "et_reference_band" parameters.

The model is expecting a grass reference ET (ETo) and will not return valid results if an alfalfa reference ET (ETr) is used.

Expand All @@ -185,12 +187,10 @@ Reference ET Sources
GRIDMET
| Collection ID: IDAHO_EPSCOR/GRIDMET
| http://www.climatologylab.org/gridmet.html
| Alfalfa reference ET band: etr
| Grass reference ET band: eto
Spatial CIMIS
| Collection ID: projects/openet/cimis/daily
| https://cimis.water.ca.gov/SpatialData.aspx
| Alfalfa reference ET band: ETr_ASCE
| Grass reference ET band: ETo_ASCE
Example Notebooks
Expand Down
6 changes: 3 additions & 3 deletions examples/collection_interpolate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"from IPython.display import Image\n",
"import openet.sims as model\n",
"\n",
"ee.Initialize()"
"ee.Initialize(use_cloud_api=False)"
]
},
{
Expand Down Expand Up @@ -243,7 +243,7 @@
"source": [
"et_monthly_coll = model_obj.interpolate(\n",
" t_interval='monthly', \n",
" variables=['et', 'etr', 'etf'], \n",
" variables=['et', 'et_reference', 'et_fraction'], \n",
" interp_method=interp_method,\n",
" interp_days=interp_days,\n",
")\n",
Expand Down Expand Up @@ -338,7 +338,7 @@
}
],
"source": [
"Image(url=ee.Image(et_monthly_coll.select(['etr']).sum())\\\n",
"Image(url=ee.Image(et_monthly_coll.select(['et_reference']).sum())\\\n",
" .reproject(crs=study_crs, scale=100)\\\n",
" .getThumbURL({'min': 0.0, 'max': 300, 'palette': et_palette, 'region': study_region}),\n",
" embed=True, format='png') "
Expand Down
10 changes: 5 additions & 5 deletions examples/collection_overpass.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"from IPython.display import Image\n",
"import openet.sims as model\n",
"\n",
"ee.Initialize()"
"ee.Initialize(use_cloud_api=False)"
]
},
{
Expand Down Expand Up @@ -153,7 +153,7 @@
"metadata": {},
"outputs": [],
"source": [
"overpass_coll = model_obj.overpass(variables=['ndvi', 'et', 'etr', 'etf'])"
"overpass_coll = model_obj.overpass(variables=['ndvi', 'et', 'et_reference', 'et_fraction'])"
]
},
{
Expand Down Expand Up @@ -182,7 +182,7 @@
"overpass_df = get_region_df(overpass_coll.getRegion(test_point, scale=30).getInfo())\n",
"pprint.pprint(overpass_df)\n",
"print('')\n",
"pprint.pprint(overpass_df[['et', 'etr']].sum())"
"pprint.pprint(overpass_df[['et', 'et_reference']].sum())"
]
},
{
Expand Down Expand Up @@ -241,7 +241,7 @@
}
],
"source": [
"Image(url=ee.Image(overpass_coll.select(['etf']).mean())\\\n",
"Image(url=ee.Image(overpass_coll.select(['et_fraction']).mean())\\\n",
" .reproject(crs=study_crs, scale=30)\\\n",
" .getThumbURL({'min': 0.0, 'max': 1.2, 'palette': et_palette, 'region': study_region}),\n",
" embed=True, format='png')"
Expand Down Expand Up @@ -272,7 +272,7 @@
}
],
"source": [
"Image(url=ee.Image(overpass_coll.select(['etr']).mean())\\\n",
"Image(url=ee.Image(overpass_coll.select(['et_reference']).mean())\\\n",
" .reproject(crs=study_crs, scale=30)\\\n",
" .getThumbURL({'min': 0.0, 'max': 12, 'palette': et_palette, 'region': study_region}),\n",
" embed=True, format='png')"
Expand Down
19 changes: 10 additions & 9 deletions examples/image_mapping.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"from IPython.display import Image\n",
"import openet.sims as model\n",
"\n",
"ee.Initialize()"
"ee.Initialize(use_cloud_api=False)"
]
},
{
Expand Down Expand Up @@ -52,10 +52,10 @@
"source": [
"collection_id = 'LANDSAT/LC08/C01/T1_SR'\n",
"\n",
"etr_source = 'projects/climate-engine/cimis/daily'\n",
"etr_band = 'ETo'\n",
"# etr_source = 'IDAHO_EPSCOR/GRIDMET'\n",
"# etr_band = 'eto'\n",
"et_reference_source = 'projects/climate-engine/cimis/daily'\n",
"et_reference_band = 'ETo'\n",
"# et_reference_source = 'IDAHO_EPSCOR/GRIDMET'\n",
"# et_reference_band = 'eto'\n",
"\n",
"# Date range you want to aggregate ET over\n",
"# End date is inclusive\n",
Expand Down Expand Up @@ -154,7 +154,8 @@
"def compute_et(image):\n",
" \"\"\"Return an ET image for each input Landsat 8 C1 SR image\"\"\"\n",
" return model.Image.from_landsat_c1_sr(\n",
" image, etr_source=etr_source, etr_band=etr_band).et\n",
" image, et_reference_source=et_reference_source, \n",
" et_reference_band=et_reference_band).et\n",
" \n",
"# Build the SIMS model for each image then compute and return ET\n",
"et_coll = ee.ImageCollection(landsat_coll.map(compute_et))\n",
Expand Down Expand Up @@ -207,8 +208,8 @@
"def custom_et(image):\n",
" image_obj = model.Image.from_landsat_c1_sr(\n",
" image, \n",
" etr_source='IDAHO_EPSCOR/GRIDMET', \n",
" etr_band='eto',\n",
" et_reference_source='IDAHO_EPSCOR/GRIDMET', \n",
" et_reference_band='eto',\n",
" # tdiff_threshold=1\n",
" )\n",
" return image_obj.et\n",
Expand Down Expand Up @@ -257,7 +258,7 @@
"source": [
"def compute_vars(image):\n",
" \"\"\"Return an ET image for each input Landsat 8 C1 SR image\"\"\"\n",
" return model.Image.from_landsat_c1_sr(image, etr_source=etr_source, etr_band=etr_band)\\\n",
" return model.Image.from_landsat_c1_sr(image, et_reference_source=et_reference_source, et_reference_band=et_reference_band)\\\n",
" .calculate(['et', 'etr', 'etf'])\n",
" \n",
"vars_coll = ee.ImageCollection(landsat_coll.map(compute_vars))\n",
Expand Down
12 changes: 7 additions & 5 deletions examples/single_image.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"from IPython.display import Image\n",
"import openet.sims as model\n",
"\n",
"ee.Initialize()"
"ee.Initialize(use_cloud_api=False)"
]
},
{
Expand Down Expand Up @@ -89,7 +89,9 @@
"source": [
"# Build the SIMS object from the Landsat image\n",
"model_obj = model.Image.from_landsat_c1_sr(\n",
" landsat_img, etr_source='projects/climate-engine/cimis/daily', etr_band='ETo',\n",
" landsat_img, \n",
" et_reference_source='projects/climate-engine/cimis/daily', \n",
" et_reference_band='ETo',\n",
" # crop_type_source='USDA/NASS/CDL/2017',\n",
" crop_type_source='projects/openet/crop_type',\n",
")"
Expand Down Expand Up @@ -207,7 +209,7 @@
}
],
"source": [
"Image(url=model_obj.etf.getThumbURL({'min': 0.0, 'max': 1.2, 'palette': et_palette}),\n",
"Image(url=model_obj.et_fraction.getThumbURL({'min': 0.0, 'max': 1.2, 'palette': et_palette}),\n",
" embed=True, format='png')"
]
},
Expand Down Expand Up @@ -237,7 +239,7 @@
],
"source": [
"# Clip and project to the Landsat image footprint and coordinate system\n",
"Image(url=model_obj.etr.getThumbURL({'min': 0, 'max': 12, 'palette': et_palette, 'region': landsat_region}),\n",
"Image(url=model_obj.et_reference.getThumbURL({'min': 0, 'max': 12, 'palette': et_palette, 'region': landsat_region}),\n",
" embed=True, format='png')"
]
},
Expand Down Expand Up @@ -297,7 +299,7 @@
}
],
"source": [
"Image(url=model_obj.calculate(['et', 'etr', 'etf']).select(['et'])\\\n",
"Image(url=model_obj.calculate(['et', 'et_reference', 'et_fraction']).select(['et'])\\\n",
" .getThumbURL({'min': 0, 'max': 12, 'palette': et_palette}),\n",
" embed=True, format='png')"
]
Expand Down
3 changes: 2 additions & 1 deletion openet/sims/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .image import Image
from .collection import Collection
from . import interpolate

__version__ = "0.0.12"
__version__ = "0.0.16"

MODEL_NAME = 'SIMS'
Loading

0 comments on commit 217589a

Please sign in to comment.