From 5dbc2f905ae7a07ae843256c7f4b3262c3d85e37 Mon Sep 17 00:00:00 2001 From: cyschneck <22159116+cyschneck@users.noreply.github.com> Date: Fri, 22 Nov 2024 14:00:49 -0700 Subject: [PATCH 1/6] setup receipt, combine ncl_raw --- ncl/ncl_entries/meteorology.ipynb | 72 +++++++++++++++++++- ncl/ncl_raw/daylight_fao56.ncl | 14 ---- ncl/ncl_raw/dewtemp_trh.ncl | 14 ---- ncl/ncl_raw/meteorology.ncl | 42 ++++++++++++ ncl/receipts/meteorology.ipynb | 108 ++++++++++++++++++++++++++---- 5 files changed, 207 insertions(+), 43 deletions(-) delete mode 100644 ncl/ncl_raw/daylight_fao56.ncl delete mode 100644 ncl/ncl_raw/dewtemp_trh.ncl create mode 100644 ncl/ncl_raw/meteorology.ncl diff --git a/ncl/ncl_entries/meteorology.ipynb b/ncl/ncl_entries/meteorology.ipynb index 64efce4f..40c22cae 100644 --- a/ncl/ncl_entries/meteorology.ipynb +++ b/ncl/ncl_entries/meteorology.ipynb @@ -16,7 +16,8 @@ "This section covers meteorology functions from NCL:\n", "\n", "- [dewtemp_trh](https://www.ncl.ucar.edu/Document/Functions/Built-in/dewtemp_trh.shtml)\n", - "- [daylight_fao56](https://www.ncl.ucar.edu/Document/Functions/Crop/daylight_fao56.shtml)" + "- [daylight_fao56](https://www.ncl.ucar.edu/Document/Functions/Crop/daylight_fao56.shtml)\n", + "- [satvpr_temp_fao56](https://www.ncl.ucar.edu/Document/Functions/Crop/satvpr_temp_fao56.shtml)" ] }, { @@ -116,6 +117,72 @@ "max_daylight(days_of_year, latitudes)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## satvpr_temp_fao56\n", + "\n", + "NCL's `satvpr_temp_fao56` calculates saturation vapor pressure using temperature as described in the Food and Agriculture Organization (FAO) Irrigation and Drainage Paper 56 [(Chapter 3, Equation 11)](https://www.fao.org/4/x0490e/x0490e07.htm) {footcite}`allan_fao_1998`" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Grab and Go" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(1.22796262)" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Input: Single Value\n", + "from geocat.comp import saturation_vapor_pressure\n", + "\n", + "temp = 50 # Fahrenheit\n", + "\n", + "saturation_vapor_pressure(temp)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([ 0.63594167, 1.22796262, 6.54556639, 102.21571649])" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Input: List/Array\n", + "from geocat.comp import saturation_vapor_pressure\n", + "\n", + "temp = [33, 50, 100, 212] # Fahrenheit\n", + "\n", + "saturation_vapor_pressure(temp)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -131,6 +198,7 @@ "- [GeoCAT-comp `dewtemp` documentation](https://geocat-comp.readthedocs.io/en/latest/user_api/generated/geocat.comp.meteorology.dewtemp.html)\n", "- [Convert between different temperature scales in SciPy](https://docs.scipy.org/doc/scipy/reference/generated/scipy.constants.convert_temperature.html)\n", "- [GeoCAT-comp `max_daylight` Documentation](https://geocat-comp.readthedocs.io/en/latest/user_api/generated/geocat.comp.meteorology.max_daylight.html)\n", + "- [GeoCAT-comp `saturation_vapor_pressure` Documentation](https://geocat-comp.readthedocs.io/en/latest/user_api/generated/geocat.comp.meteorology.saturation_vapor_pressure.html)\n", "\n", "## Additional Reading\n", "- [NOAA: Dew Point vs. Humidity](https://www.weather.gov/arx/why_dewpoint_vs_humidity)" @@ -163,7 +231,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.12.7" } }, "nbformat": 4, diff --git a/ncl/ncl_raw/daylight_fao56.ncl b/ncl/ncl_raw/daylight_fao56.ncl deleted file mode 100644 index d126ce7c..00000000 --- a/ncl/ncl_raw/daylight_fao56.ncl +++ /dev/null @@ -1,14 +0,0 @@ -; daylight_fao56 -; Adapted from https://www.ncl.ucar.edu/Document/Functions/Crop/daylight_fao56.shtml - -; ncl -n daylight_fao56.ncl >> daylight_fao56_output.txt - -print("DOY, Latitude (Degrees), Daylight Hours") -do doy=0,365 - do lat=-66,66 - begin - daylight_hours = daylight_fao56(doy, lat) - print (doy +","+ lat +","+ daylight_hours) - end - end do -end do diff --git a/ncl/ncl_raw/dewtemp_trh.ncl b/ncl/ncl_raw/dewtemp_trh.ncl deleted file mode 100644 index 8fa6c2e8..00000000 --- a/ncl/ncl_raw/dewtemp_trh.ncl +++ /dev/null @@ -1,14 +0,0 @@ -; dewtemp_trh -; Adapted from https://www.ncl.ucar.edu/Document/Functions/Built-in/dewtemp_trh.shtml - -; ncl -n dewtemp_trh.ncl >> dewtemp_trh_output.txt - -print("Temperature (K), Relative Humidity (%), Dew Temperature (C)") -do tk=273,374 - do rh=1,100 - begin - dewtemp = dewtemp_trh(tk,rh)-273.15 - print (tk +","+ rh +","+ dewtemp) - end - end do -end do diff --git a/ncl/ncl_raw/meteorology.ncl b/ncl/ncl_raw/meteorology.ncl new file mode 100644 index 00000000..e055c49b --- /dev/null +++ b/ncl/ncl_raw/meteorology.ncl @@ -0,0 +1,42 @@ +; daylight_fao56 +; Adapted from https://www.ncl.ucar.edu/Document/Functions/Crop/daylight_fao56.shtml + +; ncl -n daylight_fao56.ncl >> daylight_fao56_output.txt + +print("DOY, Latitude (Degrees), Daylight Hours") +do doy=0,365 + do lat=-66,66 + begin + daylight_hours = daylight_fao56(doy, lat) + print (doy +","+ lat +","+ daylight_hours) + end + end do +end do + +; dewtemp_trh +; Adapted from https://www.ncl.ucar.edu/Document/Functions/Built-in/dewtemp_trh.shtml + +; ncl -n dewtemp_trh.ncl >> dewtemp_trh_output.txt + +print("Temperature (K), Relative Humidity (%), Dew Temperature (C)") +do tk=273,374 + do rh=1,100 + begin + dewtemp = dewtemp_trh(tk,rh)-273.15 + print (tk +","+ rh +","+ dewtemp) + end + end do +end do + +; satvpr_temp_fao56 +; Adapted from https://www.ncl.ucar.edu/Document/Functions/Crop/satvpr_temp_fao56.shtml + +; ncl -n satvpr_temp_fao56.ncl >> satvpr_temp_fao56_output.txt + +print("Temperature (F), Saturation Vapor Pressure (kPa)") +do temp=33,212 + begin + sat_vpr_pressure = satvpr_temp_fao56(temp, (/2, 2/)) + print (temp + "," + sat_vpr_pressure) + end +end do diff --git a/ncl/receipts/meteorology.ipynb b/ncl/receipts/meteorology.ipynb index 053569ef..0b3cb0dc 100644 --- a/ncl/receipts/meteorology.ipynb +++ b/ncl/receipts/meteorology.ipynb @@ -25,7 +25,8 @@ "source": [ "## Functions covered\n", "- [dewtemp_trh](https://www.ncl.ucar.edu/Document/Functions/Built-in/dewtemp_trh.shtml)\n", - "- [daylight_fao56](https://www.ncl.ucar.edu/Document/Functions/Crop/daylight_fao56.shtml)" + "- [daylight_fao56](https://www.ncl.ucar.edu/Document/Functions/Crop/daylight_fao56.shtml)\n", + "- [satvpr_temp_fao56](https://www.ncl.ucar.edu/Document/Functions/Crop/satvpr_temp_fao56.shtml)" ] }, { @@ -41,17 +42,7 @@ "id": "3d70616a8934f0fb", "metadata": {}, "source": [ - "```{literalinclude} ../ncl_raw/dewtemp_trh.ncl\n", - "\n", - "```" - ] - }, - { - "cell_type": "markdown", - "id": "3b32a066-055f-454b-a843-e57dca954dad", - "metadata": {}, - "source": [ - "```{literalinclude} ../ncl_raw/daylight_fao56.ncl\n", + "```{literalinclude} ../ncl_raw/meteorology.ncl\n", "\n", "```" ] @@ -184,6 +175,56 @@ " geocat_daylight[pair] = max_daylight(doy, lat)" ] }, + { + "cell_type": "markdown", + "id": "a1401358-81a8-4477-9bc9-bbdaf4224c76", + "metadata": {}, + "source": [ + "### satvpr_temp_fao56" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "39c75093-80bc-44c8-880e-ad7f3cfc605c", + "metadata": {}, + "outputs": [], + "source": [ + "#### Collect NCL values for satvpr_temp_fao56 from geocat-datafiles\n", + "#import geocat.datafiles as gdf\n", + "import numpy as np\n", + "\n", + "#satvpr_temp_fao56_data = gdf.get('applications_files/ncl_outputs/daylight_fao56_output.txt')\n", + "satvpr_temp_fao56_data = np.loadtxt(\"satvpr_temp_fao56_output.txt\", delimiter=',', skiprows=6)" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "00f0ba20-176f-4139-bc65-a14e01695494", + "metadata": {}, + "outputs": [], + "source": [ + "### Collect NCL `satvpr_temp_fao56` value and associated (temp, satvpr_temp) values\n", + "ncl_satvpr_temp_fao56 = dict(zip(satvpr_temp_fao56_data[::, 0], satvpr_temp_fao56_data[::, 1]))" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "128843eb-c4ad-425a-a1ec-de89545bcb15", + "metadata": {}, + "outputs": [], + "source": [ + "### Calculate GeoCAT-Comp `satvpr_temp_fao56`\n", + "from geocat.comp import saturation_vapor_pressure\n", + "\n", + "geocat_satvpr_temp_fao56 = {}\n", + "\n", + "for temp in range(33, 212+1):\n", + " geocat_satvpr_temp_fao56[temp] = saturation_vapor_pressure(temp)" + ] + }, { "cell_type": "markdown", "id": "3237a0bffc6827fc", @@ -192,6 +233,14 @@ "## Comparison" ] }, + { + "cell_type": "markdown", + "id": "38089ce5-395d-4956-8297-cde6ef5aa99e", + "metadata": {}, + "source": [ + "### dewtemp_trh" + ] + }, { "cell_type": "code", "execution_count": null, @@ -215,6 +264,14 @@ " print(f\"\\tDifference: {ncl_dewtemp[pair] - geocat_dewtemp[pair]}\")" ] }, + { + "cell_type": "markdown", + "id": "b9cd9ad4-f898-460c-b79b-eef6f7a8e89d", + "metadata": {}, + "source": [ + "### daylight_fao56" + ] + }, { "cell_type": "code", "execution_count": null, @@ -222,11 +279,36 @@ "metadata": {}, "outputs": [], "source": [ + "import math\n", + "\n", "for pair in ncl_daylight.keys():\n", " assert math.isclose(\n", " ncl_daylight[pair], geocat_daylight[pair].flatten()[0], rel_tol=1e-05\n", " ) # within 5 decimal points" ] + }, + { + "cell_type": "markdown", + "id": "db0d8bbd-4899-4932-a28d-107c08e12a15", + "metadata": {}, + "source": [ + "### satvpr_temp_fao56" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "134f8583-0e96-43fe-8b0b-94a5e58566be", + "metadata": {}, + "outputs": [], + "source": [ + "import math\n", + "\n", + "for key in ncl_satvpr_temp_fao56.keys():\n", + " assert math.isclose(\n", + " ncl_satvpr_temp_fao56[key], geocat_satvpr_temp_fao56[key], rel_tol=1e-05\n", + " ) # within 5 decimal points" + ] } ], "metadata": { @@ -245,7 +327,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.12.7" } }, "nbformat": 4, From c06a8e9fe4d908562a80e74d0ec79c579e0b79b7 Mon Sep 17 00:00:00 2001 From: cyschneck <22159116+cyschneck@users.noreply.github.com> Date: Fri, 22 Nov 2024 14:06:20 -0700 Subject: [PATCH 2/6] update pre-commit --- ncl/ncl_entries/meteorology.ipynb | 4 ++-- ncl/receipts/meteorology.ipynb | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ncl/ncl_entries/meteorology.ipynb b/ncl/ncl_entries/meteorology.ipynb index 40c22cae..a329cb22 100644 --- a/ncl/ncl_entries/meteorology.ipynb +++ b/ncl/ncl_entries/meteorology.ipynb @@ -153,7 +153,7 @@ "# Input: Single Value\n", "from geocat.comp import saturation_vapor_pressure\n", "\n", - "temp = 50 # Fahrenheit\n", + "temp = 50 # Fahrenheit\n", "\n", "saturation_vapor_pressure(temp)" ] @@ -178,7 +178,7 @@ "# Input: List/Array\n", "from geocat.comp import saturation_vapor_pressure\n", "\n", - "temp = [33, 50, 100, 212] # Fahrenheit\n", + "temp = [33, 50, 100, 212] # Fahrenheit\n", "\n", "saturation_vapor_pressure(temp)" ] diff --git a/ncl/receipts/meteorology.ipynb b/ncl/receipts/meteorology.ipynb index 0b3cb0dc..7c8cdbc9 100644 --- a/ncl/receipts/meteorology.ipynb +++ b/ncl/receipts/meteorology.ipynb @@ -191,11 +191,13 @@ "outputs": [], "source": [ "#### Collect NCL values for satvpr_temp_fao56 from geocat-datafiles\n", - "#import geocat.datafiles as gdf\n", + "# import geocat.datafiles as gdf\n", "import numpy as np\n", "\n", - "#satvpr_temp_fao56_data = gdf.get('applications_files/ncl_outputs/daylight_fao56_output.txt')\n", - "satvpr_temp_fao56_data = np.loadtxt(\"satvpr_temp_fao56_output.txt\", delimiter=',', skiprows=6)" + "# satvpr_temp_fao56_data = gdf.get('applications_files/ncl_outputs/daylight_fao56_output.txt')\n", + "satvpr_temp_fao56_data = np.loadtxt(\n", + " \"satvpr_temp_fao56_output.txt\", delimiter=',', skiprows=6\n", + ")" ] }, { @@ -206,7 +208,9 @@ "outputs": [], "source": [ "### Collect NCL `satvpr_temp_fao56` value and associated (temp, satvpr_temp) values\n", - "ncl_satvpr_temp_fao56 = dict(zip(satvpr_temp_fao56_data[::, 0], satvpr_temp_fao56_data[::, 1]))" + "ncl_satvpr_temp_fao56 = dict(\n", + " zip(satvpr_temp_fao56_data[::, 0], satvpr_temp_fao56_data[::, 1])\n", + ")" ] }, { @@ -221,7 +225,7 @@ "\n", "geocat_satvpr_temp_fao56 = {}\n", "\n", - "for temp in range(33, 212+1):\n", + "for temp in range(33, 212 + 1):\n", " geocat_satvpr_temp_fao56[temp] = saturation_vapor_pressure(temp)" ] }, From 482ba2dac85569ac7d48e63a6158534cbaea9d2d Mon Sep 17 00:00:00 2001 From: cyschneck <22159116+cyschneck@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:12:48 -0700 Subject: [PATCH 3/6] update to datafiles --- ncl/receipts/meteorology.ipynb | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/ncl/receipts/meteorology.ipynb b/ncl/receipts/meteorology.ipynb index 7c8cdbc9..952a30f5 100644 --- a/ncl/receipts/meteorology.ipynb +++ b/ncl/receipts/meteorology.ipynb @@ -185,37 +185,33 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "39c75093-80bc-44c8-880e-ad7f3cfc605c", "metadata": {}, "outputs": [], "source": [ "#### Collect NCL values for satvpr_temp_fao56 from geocat-datafiles\n", - "# import geocat.datafiles as gdf\n", + "import geocat.datafiles as gdf\n", "import numpy as np\n", "\n", - "# satvpr_temp_fao56_data = gdf.get('applications_files/ncl_outputs/daylight_fao56_output.txt')\n", - "satvpr_temp_fao56_data = np.loadtxt(\n", - " \"satvpr_temp_fao56_output.txt\", delimiter=',', skiprows=6\n", - ")" + "satvpr_temp_fao56_data = gdf.get('applications_files/ncl_outputs/satvpr_temp_fao56_output.txt')\n", + "satvpr_temp_fao56_data = np.loadtxt(satvpr_temp_fao56_data, delimiter=',', skiprows=6)" ] }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "00f0ba20-176f-4139-bc65-a14e01695494", "metadata": {}, "outputs": [], "source": [ "### Collect NCL `satvpr_temp_fao56` value and associated (temp, satvpr_temp) values\n", - "ncl_satvpr_temp_fao56 = dict(\n", - " zip(satvpr_temp_fao56_data[::, 0], satvpr_temp_fao56_data[::, 1])\n", - ")" + "ncl_satvpr_temp_fao56 = dict(zip(satvpr_temp_fao56_data[::, 0], satvpr_temp_fao56_data[::, 1]))" ] }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "128843eb-c4ad-425a-a1ec-de89545bcb15", "metadata": {}, "outputs": [], @@ -225,7 +221,7 @@ "\n", "geocat_satvpr_temp_fao56 = {}\n", "\n", - "for temp in range(33, 212 + 1):\n", + "for temp in range(33, 212+1):\n", " geocat_satvpr_temp_fao56[temp] = saturation_vapor_pressure(temp)" ] }, @@ -301,7 +297,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "134f8583-0e96-43fe-8b0b-94a5e58566be", "metadata": {}, "outputs": [], From ac86ea1f60624d430c3ce3c23f718004407876a2 Mon Sep 17 00:00:00 2001 From: cyschneck <22159116+cyschneck@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:15:36 -0700 Subject: [PATCH 4/6] update pre-commits --- ncl/receipts/meteorology.ipynb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ncl/receipts/meteorology.ipynb b/ncl/receipts/meteorology.ipynb index 952a30f5..c51b2fb2 100644 --- a/ncl/receipts/meteorology.ipynb +++ b/ncl/receipts/meteorology.ipynb @@ -194,7 +194,9 @@ "import geocat.datafiles as gdf\n", "import numpy as np\n", "\n", - "satvpr_temp_fao56_data = gdf.get('applications_files/ncl_outputs/satvpr_temp_fao56_output.txt')\n", + "satvpr_temp_fao56_data = gdf.get(\n", + " 'applications_files/ncl_outputs/satvpr_temp_fao56_output.txt'\n", + ")\n", "satvpr_temp_fao56_data = np.loadtxt(satvpr_temp_fao56_data, delimiter=',', skiprows=6)" ] }, @@ -206,7 +208,9 @@ "outputs": [], "source": [ "### Collect NCL `satvpr_temp_fao56` value and associated (temp, satvpr_temp) values\n", - "ncl_satvpr_temp_fao56 = dict(zip(satvpr_temp_fao56_data[::, 0], satvpr_temp_fao56_data[::, 1]))" + "ncl_satvpr_temp_fao56 = dict(\n", + " zip(satvpr_temp_fao56_data[::, 0], satvpr_temp_fao56_data[::, 1])\n", + ")" ] }, { @@ -221,7 +225,7 @@ "\n", "geocat_satvpr_temp_fao56 = {}\n", "\n", - "for temp in range(33, 212+1):\n", + "for temp in range(33, 212 + 1):\n", " geocat_satvpr_temp_fao56[temp] = saturation_vapor_pressure(temp)" ] }, From ef1523f1bac967fd81dc60324c331801f14d4553 Mon Sep 17 00:00:00 2001 From: cyschneck <22159116+cyschneck@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:04:15 -0700 Subject: [PATCH 5/6] update index, clear outputs --- ncl/ncl_entries/meteorology.ipynb | 38 +++++++------------------------ ncl/ncl_index/ncl-index-table.csv | 1 + ncl/receipts/meteorology.ipynb | 10 +++----- 3 files changed, 12 insertions(+), 37 deletions(-) diff --git a/ncl/ncl_entries/meteorology.ipynb b/ncl/ncl_entries/meteorology.ipynb index a329cb22..40b9bcc9 100644 --- a/ncl/ncl_entries/meteorology.ipynb +++ b/ncl/ncl_entries/meteorology.ipynb @@ -135,50 +135,28 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "array(1.22796262)" - ] - }, - "execution_count": 1, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Input: Single Value\n", "from geocat.comp import saturation_vapor_pressure\n", "\n", - "temp = 50 # Fahrenheit\n", + "temp = 50 # Fahrenheit\n", "\n", "saturation_vapor_pressure(temp)" ] }, { "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "array([ 0.63594167, 1.22796262, 6.54556639, 102.21571649])" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Input: List/Array\n", "from geocat.comp import saturation_vapor_pressure\n", "\n", - "temp = [33, 50, 100, 212] # Fahrenheit\n", + "temp = [33, 50, 100, 212] # Fahrenheit\n", "\n", "saturation_vapor_pressure(temp)" ] diff --git a/ncl/ncl_index/ncl-index-table.csv b/ncl/ncl_index/ncl-index-table.csv index 52491b38..c339c5e7 100644 --- a/ncl/ncl_index/ncl-index-table.csv +++ b/ncl/ncl_index/ncl-index-table.csv @@ -46,3 +46,4 @@ NCL Function,Description,Python Equivalent,Notes `daylight_fao56 `__," Compute maximum number of daylight hours as described in FAO 56","``geocat.comp.meteorology.max_daylight()``",`example notebook <../ncl_entries/meteorology.ipynb#daylight-fao56>`__ `dewtemp_trh `__,"Calculates the dew point temperature given temperature and relative humidity","``geocat.comp.dewtemp()``",`example notebook <../ncl_entries/meteorology.ipynb#dewtemp-trh>`__ `area_poly_sphere `__,"Calculates the area enclosed by an arbitrary polygon on the sphere","``pyproj.Geod()`` and ``shapely.geometry.polygon.Polygon()``",`example notebook <../ncl_entries/great_circle.ipynb#area-poly-sphere>`__ +`satvpr_temp_fao56 `__," Compute saturation vapor pressure using temperature as described in FAO 56","``geocat.comp.saturation_vapor_pressure()``",`example notebook <../ncl_entries/meteorology.ipynb#satvpr-temp-fao56>`__ diff --git a/ncl/receipts/meteorology.ipynb b/ncl/receipts/meteorology.ipynb index c51b2fb2..952a30f5 100644 --- a/ncl/receipts/meteorology.ipynb +++ b/ncl/receipts/meteorology.ipynb @@ -194,9 +194,7 @@ "import geocat.datafiles as gdf\n", "import numpy as np\n", "\n", - "satvpr_temp_fao56_data = gdf.get(\n", - " 'applications_files/ncl_outputs/satvpr_temp_fao56_output.txt'\n", - ")\n", + "satvpr_temp_fao56_data = gdf.get('applications_files/ncl_outputs/satvpr_temp_fao56_output.txt')\n", "satvpr_temp_fao56_data = np.loadtxt(satvpr_temp_fao56_data, delimiter=',', skiprows=6)" ] }, @@ -208,9 +206,7 @@ "outputs": [], "source": [ "### Collect NCL `satvpr_temp_fao56` value and associated (temp, satvpr_temp) values\n", - "ncl_satvpr_temp_fao56 = dict(\n", - " zip(satvpr_temp_fao56_data[::, 0], satvpr_temp_fao56_data[::, 1])\n", - ")" + "ncl_satvpr_temp_fao56 = dict(zip(satvpr_temp_fao56_data[::, 0], satvpr_temp_fao56_data[::, 1]))" ] }, { @@ -225,7 +221,7 @@ "\n", "geocat_satvpr_temp_fao56 = {}\n", "\n", - "for temp in range(33, 212 + 1):\n", + "for temp in range(33, 212+1):\n", " geocat_satvpr_temp_fao56[temp] = saturation_vapor_pressure(temp)" ] }, From 3cf38fb37fafd9203a29cea49d64388daa1bf6b4 Mon Sep 17 00:00:00 2001 From: cyschneck <22159116+cyschneck@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:04:54 -0700 Subject: [PATCH 6/6] update pre-commits --- ncl/ncl_entries/meteorology.ipynb | 4 ++-- ncl/receipts/meteorology.ipynb | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ncl/ncl_entries/meteorology.ipynb b/ncl/ncl_entries/meteorology.ipynb index 40b9bcc9..b381c4b4 100644 --- a/ncl/ncl_entries/meteorology.ipynb +++ b/ncl/ncl_entries/meteorology.ipynb @@ -142,7 +142,7 @@ "# Input: Single Value\n", "from geocat.comp import saturation_vapor_pressure\n", "\n", - "temp = 50 # Fahrenheit\n", + "temp = 50 # Fahrenheit\n", "\n", "saturation_vapor_pressure(temp)" ] @@ -156,7 +156,7 @@ "# Input: List/Array\n", "from geocat.comp import saturation_vapor_pressure\n", "\n", - "temp = [33, 50, 100, 212] # Fahrenheit\n", + "temp = [33, 50, 100, 212] # Fahrenheit\n", "\n", "saturation_vapor_pressure(temp)" ] diff --git a/ncl/receipts/meteorology.ipynb b/ncl/receipts/meteorology.ipynb index 952a30f5..c51b2fb2 100644 --- a/ncl/receipts/meteorology.ipynb +++ b/ncl/receipts/meteorology.ipynb @@ -194,7 +194,9 @@ "import geocat.datafiles as gdf\n", "import numpy as np\n", "\n", - "satvpr_temp_fao56_data = gdf.get('applications_files/ncl_outputs/satvpr_temp_fao56_output.txt')\n", + "satvpr_temp_fao56_data = gdf.get(\n", + " 'applications_files/ncl_outputs/satvpr_temp_fao56_output.txt'\n", + ")\n", "satvpr_temp_fao56_data = np.loadtxt(satvpr_temp_fao56_data, delimiter=',', skiprows=6)" ] }, @@ -206,7 +208,9 @@ "outputs": [], "source": [ "### Collect NCL `satvpr_temp_fao56` value and associated (temp, satvpr_temp) values\n", - "ncl_satvpr_temp_fao56 = dict(zip(satvpr_temp_fao56_data[::, 0], satvpr_temp_fao56_data[::, 1]))" + "ncl_satvpr_temp_fao56 = dict(\n", + " zip(satvpr_temp_fao56_data[::, 0], satvpr_temp_fao56_data[::, 1])\n", + ")" ] }, { @@ -221,7 +225,7 @@ "\n", "geocat_satvpr_temp_fao56 = {}\n", "\n", - "for temp in range(33, 212+1):\n", + "for temp in range(33, 212 + 1):\n", " geocat_satvpr_temp_fao56[temp] = saturation_vapor_pressure(temp)" ] },