From 98d718bc883acdf8d7dc7e9c47523ccfb395cc73 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:00:42 -0600 Subject: [PATCH 1/8] restructure python applications --- applications/{data_analysis => analysis}/climatology.ipynb | 0 applications/{data_analysis => analysis}/data_analysis.rst | 0 applications/{date_time => analysis}/date_time.rst | 0 applications/{date_time => analysis}/datetime.ipynb | 0 .../{data_analysis => analysis}/general_applied_math.ipynb | 0 applications/{data_analysis => analysis}/humid_heat_metrics.ipynb | 0 applications/{data_analysis => analysis}/spectral_analysis.ipynb | 0 applications/{plot_types => visualization}/plot_types.rst | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename applications/{data_analysis => analysis}/climatology.ipynb (100%) rename applications/{data_analysis => analysis}/data_analysis.rst (100%) rename applications/{date_time => analysis}/date_time.rst (100%) rename applications/{date_time => analysis}/datetime.ipynb (100%) rename applications/{data_analysis => analysis}/general_applied_math.ipynb (100%) rename applications/{data_analysis => analysis}/humid_heat_metrics.ipynb (100%) rename applications/{data_analysis => analysis}/spectral_analysis.ipynb (100%) rename applications/{plot_types => visualization}/plot_types.rst (100%) diff --git a/applications/data_analysis/climatology.ipynb b/applications/analysis/climatology.ipynb similarity index 100% rename from applications/data_analysis/climatology.ipynb rename to applications/analysis/climatology.ipynb diff --git a/applications/data_analysis/data_analysis.rst b/applications/analysis/data_analysis.rst similarity index 100% rename from applications/data_analysis/data_analysis.rst rename to applications/analysis/data_analysis.rst diff --git a/applications/date_time/date_time.rst b/applications/analysis/date_time.rst similarity index 100% rename from applications/date_time/date_time.rst rename to applications/analysis/date_time.rst diff --git a/applications/date_time/datetime.ipynb b/applications/analysis/datetime.ipynb similarity index 100% rename from applications/date_time/datetime.ipynb rename to applications/analysis/datetime.ipynb diff --git a/applications/data_analysis/general_applied_math.ipynb b/applications/analysis/general_applied_math.ipynb similarity index 100% rename from applications/data_analysis/general_applied_math.ipynb rename to applications/analysis/general_applied_math.ipynb diff --git a/applications/data_analysis/humid_heat_metrics.ipynb b/applications/analysis/humid_heat_metrics.ipynb similarity index 100% rename from applications/data_analysis/humid_heat_metrics.ipynb rename to applications/analysis/humid_heat_metrics.ipynb diff --git a/applications/data_analysis/spectral_analysis.ipynb b/applications/analysis/spectral_analysis.ipynb similarity index 100% rename from applications/data_analysis/spectral_analysis.ipynb rename to applications/analysis/spectral_analysis.ipynb diff --git a/applications/plot_types/plot_types.rst b/applications/visualization/plot_types.rst similarity index 100% rename from applications/plot_types/plot_types.rst rename to applications/visualization/plot_types.rst From 8256ade41ce2c173beb172a35606d9fde76652ae Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 18 Oct 2024 18:48:21 -0600 Subject: [PATCH 2/8] restructure --- ncl/ncl_entries/days_in_month.ipynb | 189 ------------------ ncl/ncl_entries/ncl_entries.rst | 23 --- .../examples/climatology.ipynb | 2 +- ncl_to_python/examples/examples.rst | 33 +++ .../examples}/general_applied_math.ipynb | 0 .../examples}/meteorology.ipynb | 0 .../examples/spectral_analysis.ipynb | 26 +-- .../examples/time.ipynb | 140 +++++++++++-- .../examples/trigonometry.ipynb | 8 +- .../ncl_index/ncl-index-table.csv | 0 .../ncl_index/ncl_index.rst | 0 {ncl => ncl_to_python}/ncl_raw/cal_dim.ncl | 0 .../ncl_raw/climatology.ncl | 0 .../ncl_raw/daylight_fao56.ncl | 0 .../ncl_raw/dewtemp_trh.ncl | 0 .../ncl_raw/general_applied_math.ncl | 0 .../ncl_raw/trigonometric_functions.ncl | 0 .../receipts/climatology_functions.ipynb | 0 .../receipts/days_in_month.ipynb | 0 .../receipts/general_applied_math.ipynb | 0 .../receipts/meteorology.ipynb | 0 {ncl => ncl_to_python}/receipts/receipts.rst | 0 .../receipts/specx_anal.ipynb | 0 .../receipts/trigonometric_functions.ipynb | 0 .../analysis/climatology.ipynb | 0 .../analysis/data_analysis.rst | 0 .../analysis/date_time.rst | 0 .../analysis/datetime.ipynb | 0 .../analysis/general_applied_math.ipynb | 0 .../analysis/humid_heat_metrics.ipynb | 0 .../analysis/spectral_analysis.ipynb | 0 {applications => python}/applications.rst | 0 .../visualization/plot_types.rst | 0 33 files changed, 174 insertions(+), 247 deletions(-) delete mode 100644 ncl/ncl_entries/days_in_month.ipynb delete mode 100644 ncl/ncl_entries/ncl_entries.rst rename ncl/ncl_entries/climatology_functions.ipynb => ncl_to_python/examples/climatology.ipynb (99%) create mode 100644 ncl_to_python/examples/examples.rst rename {ncl/ncl_entries => ncl_to_python/examples}/general_applied_math.ipynb (100%) rename {ncl/ncl_entries => ncl_to_python/examples}/meteorology.ipynb (100%) rename ncl/ncl_entries/specx_specxy_anal.ipynb => ncl_to_python/examples/spectral_analysis.ipynb (97%) rename ncl/ncl_entries/day_of_week.ipynb => ncl_to_python/examples/time.ipynb (55%) rename ncl/ncl_entries/trigonometric_functions.ipynb => ncl_to_python/examples/trigonometry.ipynb (99%) rename {ncl => ncl_to_python}/ncl_index/ncl-index-table.csv (100%) rename {ncl => ncl_to_python}/ncl_index/ncl_index.rst (100%) rename {ncl => ncl_to_python}/ncl_raw/cal_dim.ncl (100%) rename {ncl => ncl_to_python}/ncl_raw/climatology.ncl (100%) rename {ncl => ncl_to_python}/ncl_raw/daylight_fao56.ncl (100%) rename {ncl => ncl_to_python}/ncl_raw/dewtemp_trh.ncl (100%) rename {ncl => ncl_to_python}/ncl_raw/general_applied_math.ncl (100%) rename {ncl => ncl_to_python}/ncl_raw/trigonometric_functions.ncl (100%) rename {ncl => ncl_to_python}/receipts/climatology_functions.ipynb (100%) rename {ncl => ncl_to_python}/receipts/days_in_month.ipynb (100%) rename {ncl => ncl_to_python}/receipts/general_applied_math.ipynb (100%) rename {ncl => ncl_to_python}/receipts/meteorology.ipynb (100%) rename {ncl => ncl_to_python}/receipts/receipts.rst (100%) rename {ncl => ncl_to_python}/receipts/specx_anal.ipynb (100%) rename {ncl => ncl_to_python}/receipts/trigonometric_functions.ipynb (100%) rename {applications => python}/analysis/climatology.ipynb (100%) rename {applications => python}/analysis/data_analysis.rst (100%) rename {applications => python}/analysis/date_time.rst (100%) rename {applications => python}/analysis/datetime.ipynb (100%) rename {applications => python}/analysis/general_applied_math.ipynb (100%) rename {applications => python}/analysis/humid_heat_metrics.ipynb (100%) rename {applications => python}/analysis/spectral_analysis.ipynb (100%) rename {applications => python}/applications.rst (100%) rename {applications => python}/visualization/plot_types.rst (100%) diff --git a/ncl/ncl_entries/days_in_month.ipynb b/ncl/ncl_entries/days_in_month.ipynb deleted file mode 100644 index d2d87bfe..00000000 --- a/ncl/ncl_entries/days_in_month.ipynb +++ /dev/null @@ -1,189 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "85f94cfa6f4fae8e", - "metadata": {}, - "source": [ - "# days_in_month" - ] - }, - { - "cell_type": "markdown", - "id": "5df936372159018b", - "metadata": {}, - "source": [ - "## Overview\n", - "NCL's [`days_in_month`](https://www.ncl.ucar.edu/Document/Functions/Built-in/days_in_month.shtml) calculates the number of days in a month given a month and year." - ] - }, - { - "cell_type": "markdown", - "id": "774124772c1ca8d4", - "metadata": {}, - "source": [ - "## Grab and Go" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "71b6e5623fb2f661", - "metadata": { - "ExecuteTime": { - "end_time": "2024-06-06T20:18:11.395749Z", - "start_time": "2024-06-06T20:18:11.262729Z" - } - }, - "outputs": [], - "source": [ - "import cftime\n", - "\n", - "day = 1\n", - "month = 2\n", - "year = 2024\n", - "\n", - "days = cftime.datetime(year, month, day, calendar='standard').daysinmonth\n", - "\n", - "days" - ] - }, - { - "cell_type": "markdown", - "id": "471ffe2f336259de", - "metadata": {}, - "source": [ - "---" - ] - }, - { - "cell_type": "markdown", - "id": "6b288584e85b49b9", - "metadata": {}, - "source": [ - "## Using the `calendar` module\n", - "The [`calendar`](https://docs.python.org/3/library/calendar.html) module is part of the Python Standard Library and could be sufficient to calculate the number of days in a month." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d54840a911c73610", - "metadata": { - "ExecuteTime": { - "end_time": "2024-06-06T20:18:11.399650Z", - "start_time": "2024-06-06T20:18:11.396804Z" - } - }, - "outputs": [], - "source": [ - "from calendar import monthrange\n", - "\n", - "month = 2\n", - "year = 1500\n", - "first_day, num_days = monthrange(year, month)\n", - "print(f\"Month {month} in {year} has {num_days} days\")" - ] - }, - { - "cell_type": "markdown", - "id": "82c5bb43f75c474e", - "metadata": {}, - "source": [ - "However, the `calendar` only uses a proleptic Gregorian calendar. If you need to work with other calendars, the `calendar` module will not be sufficient." - ] - }, - { - "cell_type": "markdown", - "id": "7bfc78baeee6cef4", - "metadata": {}, - "source": [ - "## Using `cftime`\n", - "[`cftime`](https://unidata.github.io/cftime/index.html) supports all of the [CF Convention calendars](https://cfconventions.org/cf-conventions/cf-conventions#calendar). Here's how you can use `cftime` to calculate the number of days in a month." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f762cbca2cf59dfa", - "metadata": { - "ExecuteTime": { - "end_time": "2024-06-06T20:18:11.403172Z", - "start_time": "2024-06-06T20:18:11.400471Z" - } - }, - "outputs": [], - "source": [ - "import cftime\n", - "\n", - "day = 1\n", - "month = 2\n", - "year = 1500\n", - "\n", - "days = cftime.datetime(year, month, day, calendar='standard').daysinmonth\n", - "print(f\"standard calendar: \\t\\t\\t\\t month {month} in {year} has {days} days\")\n", - "\n", - "days = cftime.datetime(year, month, day, calendar='proleptic_gregorian').daysinmonth\n", - "print(f\"proleptic Gregorian calendar: \\t month {month} in {year} has {days} days\")\n", - "\n", - "days = cftime.datetime(year, month, day, calendar='julian').daysinmonth\n", - "print(f\"Julian calendar: \\t\\t\\t\\t month {month} in {year} has {days} days\")\n", - "\n", - "days = cftime.datetime(year, month, day, calendar='360_day').daysinmonth\n", - "print(f\"360 day calendar: \\t\\t\\t\\t month {month} in {year} has {days} days\")" - ] - }, - { - "cell_type": "markdown", - "id": "a8b079a3a3eb9f00", - "metadata": {}, - "source": [ - "## Differences between `cftime` and NCL's `days_in_month`\n", - "\n", - "### Calendars\n", - "The calendars available in `cftime` and NCL's `days_in_month`, while both based on the CF Conventions calendars, are slightly different.\n", - "\n", - "- `cftime` does support using `\"none\"` as a calendar type, but not for this particular function. \n", - "- NCL's `days_in_month` does not support the `proleptic_gregorian` calendar.\n", - "\n", - "### Numerical Differences\n", - "Additionally, the `\"standard\"` and `\"gregorian\"` calendars seem to disagree for some historical dates.\n", - "\n", - "### Input type\n", - "Notably, using `cftime` to calculate the number of days in a month works by getting a `daysinmonth` value from a `cftime.datetime` object, which means that the calculations for days in a month have to be collected through each date individually, while NCL's `days_in_month` can take in multidimensional integer arrays, given that the `year` and `month` arrays have the same dimensions." - ] - }, - { - "cell_type": "markdown", - "id": "8eda876fd519891", - "metadata": {}, - "source": [ - "## Python Resources\n", - "- The `calendar` module [documentation](https://docs.python.org/3/library/calendar.html).\n", - "- The [`cftime.datetime` documentation](https://unidata.github.io/cftime/api.html#cftime.datetime).\n", - "- [\"Time series data\"](https://docs.xarray.dev/en/stable/user-guide/time-series.html) for working with time series data in xarray" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.3" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/ncl/ncl_entries/ncl_entries.rst b/ncl/ncl_entries/ncl_entries.rst deleted file mode 100644 index 9e216cd7..00000000 --- a/ncl/ncl_entries/ncl_entries.rst +++ /dev/null @@ -1,23 +0,0 @@ -.. _ncl_applications: - -NCL Applications -================ - -Data Analysis ---------------- -.. toctree:: - :maxdepth: 1 - - climatology_functions.ipynb - trigonometric_functions.ipynb - general_applied_math.ipynb - meteorology.ipynb - specx_specxy_anal.ipynb - -Dates and Times ---------------- -.. toctree:: - :maxdepth: 1 - - days_in_month.ipynb - day_of_week.ipynb diff --git a/ncl/ncl_entries/climatology_functions.ipynb b/ncl_to_python/examples/climatology.ipynb similarity index 99% rename from ncl/ncl_entries/climatology_functions.ipynb rename to ncl_to_python/examples/climatology.ipynb index 77c14225..0e3b7c1b 100644 --- a/ncl/ncl_entries/climatology_functions.ipynb +++ b/ncl_to_python/examples/climatology.ipynb @@ -322,7 +322,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.3" + "version": "3.12.7" } }, "nbformat": 4, diff --git a/ncl_to_python/examples/examples.rst b/ncl_to_python/examples/examples.rst new file mode 100644 index 00000000..1034ae53 --- /dev/null +++ b/ncl_to_python/examples/examples.rst @@ -0,0 +1,33 @@ +.. _ncl_applications: + +Examples +======== + +NCL to Python examples by function category with relevant context +and links to additional resources and references. + + +Geoscience +---------- +.. toctree:: + :maxdepth: 1 + + climatology.ipynb + meteorology.ipynb + + +Math +---- +.. toctree:: + :maxdepth: 1 + + trigonometry.ipynb + general_applied_math.ipynb + spectral_analysis.ipynb + +Time +---- +.. toctree:: + :maxdepth: 1 + + time.ipynb diff --git a/ncl/ncl_entries/general_applied_math.ipynb b/ncl_to_python/examples/general_applied_math.ipynb similarity index 100% rename from ncl/ncl_entries/general_applied_math.ipynb rename to ncl_to_python/examples/general_applied_math.ipynb diff --git a/ncl/ncl_entries/meteorology.ipynb b/ncl_to_python/examples/meteorology.ipynb similarity index 100% rename from ncl/ncl_entries/meteorology.ipynb rename to ncl_to_python/examples/meteorology.ipynb diff --git a/ncl/ncl_entries/specx_specxy_anal.ipynb b/ncl_to_python/examples/spectral_analysis.ipynb similarity index 97% rename from ncl/ncl_entries/specx_specxy_anal.ipynb rename to ncl_to_python/examples/spectral_analysis.ipynb index a3cb2a0a..fa7d6074 100644 --- a/ncl/ncl_entries/specx_specxy_anal.ipynb +++ b/ncl_to_python/examples/spectral_analysis.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# specx_specxy_anal\n", + "# Spectral Analysis\n", "\n", "This example demonstrates how to perform spectral and cross-spectral analysis using the `scipy.signal` module. To learn more about the functions and keyword arguments available in this package, read SciPy's [signal processing documentation](https://docs.scipy.org/doc/scipy/reference/signal.html).\n", "\n", @@ -43,7 +43,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -131,7 +131,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -158,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -185,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -211,7 +211,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -240,7 +240,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -359,7 +359,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -421,7 +421,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -461,7 +461,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -519,7 +519,7 @@ ], "metadata": { "kernelspec": { - "display_name": "geocat_comp_build", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -533,9 +533,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.2" + "version": "3.12.7" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/ncl/ncl_entries/day_of_week.ipynb b/ncl_to_python/examples/time.ipynb similarity index 55% rename from ncl/ncl_entries/day_of_week.ipynb rename to ncl_to_python/examples/time.ipynb index 1685661d..24650da0 100644 --- a/ncl/ncl_entries/day_of_week.ipynb +++ b/ncl_to_python/examples/time.ipynb @@ -4,22 +4,27 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# day_of_week" + "# Time" ] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, "source": [ "## Overview\n", - "NCL's [`day_of_week`](https://www.ncl.ucar.edu/Document/Functions/Built-in/day_of_week.shtml) calculates the day of the week given month, day, and year." + "This section covers NCL functions relating to dates and times:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Grab and Go" + "## day_of_week\n", + "NCL's [`day_of_week`](https://www.ncl.ucar.edu/Document/Functions/Built-in/day_of_week.shtml) calculates the day of the week given month, day, and year.\n", + "\n", + "### Grab and Go" ] }, { @@ -51,7 +56,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Using the `datetime` module\n", + "### Using the `datetime` module\n", "The [`datetime`](https://docs.python.org/3/library/datetime.html) module is part of the Python Standard Library and could be sufficient to calculate the day of the week. " ] }, @@ -84,7 +89,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Using `cftime`\n", + "### Using `cftime`\n", "[`cftime`](https://unidata.github.io/cftime/index.html) offers a solution to these potential issues by supporting year 0 and all of the [CF Convention calendars](https://cfconventions.org/cf-conventions/cf-conventions#calendar). Here is how you can use `cftime` to calculate the day of the week." ] }, @@ -132,14 +137,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Differences between `cftime` and NCL's `day_of_week`" + "### Differences between `cftime` and NCL's `day_of_week`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### Calendars\n", + "#### Calendars\n", "NCL's `day_of_week` only supports the proleptic Gregorian calendar, while the `cftime` module supports all CF conventions calendars, including the `proleptic_gregorian` calendar." ] }, @@ -147,7 +152,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Input Type\n", + "#### Input Type\n", "Notably, using `cftime` to calculate the day of the week works by getting a `strftime()` value from a `cftime.datetime` object, which means that the calculations for the day of the week have to be collected through each date individually, while NCL's `days_in_month` can take in multidimensional integer arrays, given that the `year` and `month` arrays have the same dimensions." ] }, @@ -155,7 +160,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Year 0\n", + "#### Year 0\n", "There is a slight difference in the way that NCL's `day_of_week` and the `cftime` module handle the year 0.\n", "- NCL's `day_of_week` supports all positive years and year 0 by default.\n", "- The `cftime` module supports all years, but handling for year 0 is dependent upon the calendar and/or the `has_year_zero` keyword argument." @@ -165,21 +170,120 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Python Resources\n", - "- The `datetime` module [documentation](https://docs.python.org/3/library/datetime.html).\n", - "- The `cftime.datetime` [documentation](https://unidata.github.io/cftime/api.html#cftime.datetime).\n", - "- [Working with Dates and Times](https://ncar.github.io/geocat-applications/applications/date_time/datetime.html) GeoCAT Applications notebook." + "## days_in_month\n", + "NCL's [`days_in_month`](https://www.ncl.ucar.edu/Document/Functions/Built-in/days_in_month.shtml) calculates the number of days in a month given a month and year.\n", + "\n", + "### Grab and Go" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import cftime\n", + "\n", + "day = 1\n", + "month = 2\n", + "year = 2024\n", + "\n", + "days = cftime.datetime(year, month, day, calendar='standard').daysinmonth\n", + "\n", + "days" ] }, { "cell_type": "markdown", "metadata": {}, - "source": [] + "source": [ + "### Using the `calendar` module\n", + "The [`calendar`](https://docs.python.org/3/library/calendar.html) module is part of the Python Standard Library and could be sufficient to calculate the number of days in a month." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from calendar import monthrange\n", + "\n", + "month = 2\n", + "year = 1500\n", + "first_day, num_days = monthrange(year, month)\n", + "print(f\"Month {month} in {year} has {num_days} days\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "However, the `calendar` only uses a proleptic Gregorian calendar. If you need to work with other calendars, the `calendar` module will not be sufficient.\n", + "\n", + "### Using `cftime`\n", + "[`cftime`](https://unidata.github.io/cftime/index.html) supports all of the [CF Convention calendars](https://cfconventions.org/cf-conventions/cf-conventions#calendar). Here's how you can use `cftime` to calculate the number of days in a month." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import cftime\n", + "\n", + "day = 1\n", + "month = 2\n", + "year = 1500\n", + "\n", + "days = cftime.datetime(year, month, day, calendar='standard').daysinmonth\n", + "print(f\"standard calendar: \\t\\t\\t\\t month {month} in {year} has {days} days\")\n", + "\n", + "days = cftime.datetime(year, month, day, calendar='proleptic_gregorian').daysinmonth\n", + "print(f\"proleptic Gregorian calendar: \\t month {month} in {year} has {days} days\")\n", + "\n", + "days = cftime.datetime(year, month, day, calendar='julian').daysinmonth\n", + "print(f\"Julian calendar: \\t\\t\\t\\t month {month} in {year} has {days} days\")\n", + "\n", + "days = cftime.datetime(year, month, day, calendar='360_day').daysinmonth\n", + "print(f\"360 day calendar: \\t\\t\\t\\t month {month} in {year} has {days} days\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Differences between `cftime` and NCL's `days_in_month`\n", + "\n", + "#### Calendars\n", + "The calendars available in `cftime` and NCL's `days_in_month`, while both based on the CF Conventions calendars, are slightly different.\n", + "\n", + "- `cftime` does support using `\"none\"` as a calendar type, but not for this particular function. \n", + "- NCL's `days_in_month` does not support the `proleptic_gregorian` calendar.\n", + "\n", + "#### Numerical Differences\n", + "Additionally, the `\"standard\"` and `\"gregorian\"` calendars seem to disagree for some historical dates.\n", + "\n", + "#### Input type\n", + "Notably, using `cftime` to calculate the number of days in a month works by getting a `daysinmonth` value from a `cftime.datetime` object, which means that the calculations for days in a month have to be collected through each date individually, while NCL's `days_in_month` can take in multidimensional integer arrays, given that the `year` and `month` arrays have the same dimensions." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Python Resources\n", + "- The `datetime` module [documentation](https://docs.python.org/3/library/datetime.html)\n", + "- The `cftime.datetime` [documentation](https://unidata.github.io/cftime/api.html#cftime.datetime)\n", + "- The [time series data](https://docs.xarray.dev/en/stable/user-guide/time-series.html) section of the Xarray documentation for working with time series data in Xarray\n", + "- [Working with Dates and Times](https://ncar.github.io/geocat-applications/applications/date_time/datetime.html) GeoCAT Applications notebook" + ] } ], "metadata": { "kernelspec": { - "display_name": "geocat-applications", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -193,9 +297,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.3" + "version": "3.12.7" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/ncl/ncl_entries/trigonometric_functions.ipynb b/ncl_to_python/examples/trigonometry.ipynb similarity index 99% rename from ncl/ncl_entries/trigonometric_functions.ipynb rename to ncl_to_python/examples/trigonometry.ipynb index 9ece3a08..7626c7ae 100644 --- a/ncl/ncl_entries/trigonometric_functions.ipynb +++ b/ncl_to_python/examples/trigonometry.ipynb @@ -5,13 +5,15 @@ "id": "e630c395-5419-4786-84fe-94bc0f0abbdc", "metadata": {}, "source": [ - "# Trigonometric Functions" + "# Trigonometry" ] }, { "cell_type": "markdown", "id": "cac2fd03-5dcf-478a-8cd5-72207bc2cb4b", - "metadata": {}, + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, "source": [ "## Overview\n", "The trigonometric functions for sine, cosine, and tangent (and associated inverse functions) are built-in functions in Python as well as part of a common Python package `numpy`\n", @@ -701,7 +703,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.12.7" } }, "nbformat": 4, diff --git a/ncl/ncl_index/ncl-index-table.csv b/ncl_to_python/ncl_index/ncl-index-table.csv similarity index 100% rename from ncl/ncl_index/ncl-index-table.csv rename to ncl_to_python/ncl_index/ncl-index-table.csv diff --git a/ncl/ncl_index/ncl_index.rst b/ncl_to_python/ncl_index/ncl_index.rst similarity index 100% rename from ncl/ncl_index/ncl_index.rst rename to ncl_to_python/ncl_index/ncl_index.rst diff --git a/ncl/ncl_raw/cal_dim.ncl b/ncl_to_python/ncl_raw/cal_dim.ncl similarity index 100% rename from ncl/ncl_raw/cal_dim.ncl rename to ncl_to_python/ncl_raw/cal_dim.ncl diff --git a/ncl/ncl_raw/climatology.ncl b/ncl_to_python/ncl_raw/climatology.ncl similarity index 100% rename from ncl/ncl_raw/climatology.ncl rename to ncl_to_python/ncl_raw/climatology.ncl diff --git a/ncl/ncl_raw/daylight_fao56.ncl b/ncl_to_python/ncl_raw/daylight_fao56.ncl similarity index 100% rename from ncl/ncl_raw/daylight_fao56.ncl rename to ncl_to_python/ncl_raw/daylight_fao56.ncl diff --git a/ncl/ncl_raw/dewtemp_trh.ncl b/ncl_to_python/ncl_raw/dewtemp_trh.ncl similarity index 100% rename from ncl/ncl_raw/dewtemp_trh.ncl rename to ncl_to_python/ncl_raw/dewtemp_trh.ncl diff --git a/ncl/ncl_raw/general_applied_math.ncl b/ncl_to_python/ncl_raw/general_applied_math.ncl similarity index 100% rename from ncl/ncl_raw/general_applied_math.ncl rename to ncl_to_python/ncl_raw/general_applied_math.ncl diff --git a/ncl/ncl_raw/trigonometric_functions.ncl b/ncl_to_python/ncl_raw/trigonometric_functions.ncl similarity index 100% rename from ncl/ncl_raw/trigonometric_functions.ncl rename to ncl_to_python/ncl_raw/trigonometric_functions.ncl diff --git a/ncl/receipts/climatology_functions.ipynb b/ncl_to_python/receipts/climatology_functions.ipynb similarity index 100% rename from ncl/receipts/climatology_functions.ipynb rename to ncl_to_python/receipts/climatology_functions.ipynb diff --git a/ncl/receipts/days_in_month.ipynb b/ncl_to_python/receipts/days_in_month.ipynb similarity index 100% rename from ncl/receipts/days_in_month.ipynb rename to ncl_to_python/receipts/days_in_month.ipynb diff --git a/ncl/receipts/general_applied_math.ipynb b/ncl_to_python/receipts/general_applied_math.ipynb similarity index 100% rename from ncl/receipts/general_applied_math.ipynb rename to ncl_to_python/receipts/general_applied_math.ipynb diff --git a/ncl/receipts/meteorology.ipynb b/ncl_to_python/receipts/meteorology.ipynb similarity index 100% rename from ncl/receipts/meteorology.ipynb rename to ncl_to_python/receipts/meteorology.ipynb diff --git a/ncl/receipts/receipts.rst b/ncl_to_python/receipts/receipts.rst similarity index 100% rename from ncl/receipts/receipts.rst rename to ncl_to_python/receipts/receipts.rst diff --git a/ncl/receipts/specx_anal.ipynb b/ncl_to_python/receipts/specx_anal.ipynb similarity index 100% rename from ncl/receipts/specx_anal.ipynb rename to ncl_to_python/receipts/specx_anal.ipynb diff --git a/ncl/receipts/trigonometric_functions.ipynb b/ncl_to_python/receipts/trigonometric_functions.ipynb similarity index 100% rename from ncl/receipts/trigonometric_functions.ipynb rename to ncl_to_python/receipts/trigonometric_functions.ipynb diff --git a/applications/analysis/climatology.ipynb b/python/analysis/climatology.ipynb similarity index 100% rename from applications/analysis/climatology.ipynb rename to python/analysis/climatology.ipynb diff --git a/applications/analysis/data_analysis.rst b/python/analysis/data_analysis.rst similarity index 100% rename from applications/analysis/data_analysis.rst rename to python/analysis/data_analysis.rst diff --git a/applications/analysis/date_time.rst b/python/analysis/date_time.rst similarity index 100% rename from applications/analysis/date_time.rst rename to python/analysis/date_time.rst diff --git a/applications/analysis/datetime.ipynb b/python/analysis/datetime.ipynb similarity index 100% rename from applications/analysis/datetime.ipynb rename to python/analysis/datetime.ipynb diff --git a/applications/analysis/general_applied_math.ipynb b/python/analysis/general_applied_math.ipynb similarity index 100% rename from applications/analysis/general_applied_math.ipynb rename to python/analysis/general_applied_math.ipynb diff --git a/applications/analysis/humid_heat_metrics.ipynb b/python/analysis/humid_heat_metrics.ipynb similarity index 100% rename from applications/analysis/humid_heat_metrics.ipynb rename to python/analysis/humid_heat_metrics.ipynb diff --git a/applications/analysis/spectral_analysis.ipynb b/python/analysis/spectral_analysis.ipynb similarity index 100% rename from applications/analysis/spectral_analysis.ipynb rename to python/analysis/spectral_analysis.ipynb diff --git a/applications/applications.rst b/python/applications.rst similarity index 100% rename from applications/applications.rst rename to python/applications.rst diff --git a/applications/visualization/plot_types.rst b/python/visualization/plot_types.rst similarity index 100% rename from applications/visualization/plot_types.rst rename to python/visualization/plot_types.rst From c58908843644be3cdf92db8120c40cd69b904d50 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:50:18 -0600 Subject: [PATCH 3/8] restructure again --- applications/applications.rst | 18 ++++++++++ .../geoscience}/climatology.ipynb | 0 applications/geoscience/geoscience.rst | 12 +++++++ .../geoscience}/humid_heat_metrics.ipynb | 0 .../math}/general_applied_math.ipynb | 0 .../math/math.rst | 8 ++--- .../math}/spectral_analysis.ipynb | 0 .../time}/datetime.ipynb | 0 .../time/time.rst | 6 ++-- conf.py | 2 +- index.rst | 28 +++++++-------- python/applications.rst | 35 ------------------- python/visualization/plot_types.rst | 10 ------ 13 files changed, 50 insertions(+), 69 deletions(-) create mode 100644 applications/applications.rst rename {python/analysis => applications/geoscience}/climatology.ipynb (100%) create mode 100644 applications/geoscience/geoscience.rst rename {python/analysis => applications/geoscience}/humid_heat_metrics.ipynb (100%) rename {python/analysis => applications/math}/general_applied_math.ipynb (100%) rename python/analysis/data_analysis.rst => applications/math/math.rst (54%) rename {python/analysis => applications/math}/spectral_analysis.ipynb (100%) rename {python/analysis => applications/time}/datetime.ipynb (100%) rename python/analysis/date_time.rst => applications/time/time.rst (60%) delete mode 100644 python/applications.rst delete mode 100644 python/visualization/plot_types.rst diff --git a/applications/applications.rst b/applications/applications.rst new file mode 100644 index 00000000..0204784c --- /dev/null +++ b/applications/applications.rst @@ -0,0 +1,18 @@ +.. _applications: + +.. grid:: 3 + :gutter: 2 + + .. grid-item-card:: Time + + - `Working with dates and times `_ + + .. grid-item-card:: Geoscience + + - `Calculating climatologies `_ + - `Humid heat metrics `_ + + .. grid-item-card:: Math + + - `General Applied Math `_ + - `Spectral Analysis `_ diff --git a/python/analysis/climatology.ipynb b/applications/geoscience/climatology.ipynb similarity index 100% rename from python/analysis/climatology.ipynb rename to applications/geoscience/climatology.ipynb diff --git a/applications/geoscience/geoscience.rst b/applications/geoscience/geoscience.rst new file mode 100644 index 00000000..303b711e --- /dev/null +++ b/applications/geoscience/geoscience.rst @@ -0,0 +1,12 @@ +.. currentmodule:: geocat.applications + +.. _applications_geoscience: + +Geoscience +========== + +.. toctree:: + :maxdepth: 1 + + climatology.ipynb + humid_heat_metrics.ipynb diff --git a/python/analysis/humid_heat_metrics.ipynb b/applications/geoscience/humid_heat_metrics.ipynb similarity index 100% rename from python/analysis/humid_heat_metrics.ipynb rename to applications/geoscience/humid_heat_metrics.ipynb diff --git a/python/analysis/general_applied_math.ipynb b/applications/math/general_applied_math.ipynb similarity index 100% rename from python/analysis/general_applied_math.ipynb rename to applications/math/general_applied_math.ipynb diff --git a/python/analysis/data_analysis.rst b/applications/math/math.rst similarity index 54% rename from python/analysis/data_analysis.rst rename to applications/math/math.rst index 93ad68b9..fd91dd15 100644 --- a/python/analysis/data_analysis.rst +++ b/applications/math/math.rst @@ -1,14 +1,12 @@ .. currentmodule:: geocat.applications -.. _applications_data_analysis: +.. _applications_math: -Data Analysis -============= +Math +==== .. toctree:: :maxdepth: 1 general_applied_math.ipynb - climatology.ipynb spectral_analysis.ipynb - humid_heat_metrics.ipynb diff --git a/python/analysis/spectral_analysis.ipynb b/applications/math/spectral_analysis.ipynb similarity index 100% rename from python/analysis/spectral_analysis.ipynb rename to applications/math/spectral_analysis.ipynb diff --git a/python/analysis/datetime.ipynb b/applications/time/datetime.ipynb similarity index 100% rename from python/analysis/datetime.ipynb rename to applications/time/datetime.ipynb diff --git a/python/analysis/date_time.rst b/applications/time/time.rst similarity index 60% rename from python/analysis/date_time.rst rename to applications/time/time.rst index ebd3c8c2..b8b12187 100644 --- a/python/analysis/date_time.rst +++ b/applications/time/time.rst @@ -1,9 +1,9 @@ .. currentmodule:: geocat.applications -.. _applications_datetime: +.. _applications_time: -Dates and Times -=============== +Time +==== .. toctree:: :maxdepth: 1 diff --git a/conf.py b/conf.py index b1ed81f5..6a98758a 100644 --- a/conf.py +++ b/conf.py @@ -26,7 +26,7 @@ os.makedirs(tmp_dir, exist_ok=True) # sort ncl/ncl-index-table.csv -df = pd.read_csv('ncl/ncl_index/ncl-index-table.csv') +df = pd.read_csv('ncl_to_python/ncl_index/ncl-index-table.csv') df['sort_column'] = df['NCL Function'].apply(lambda x: x[1] if len(x) > 1 else x) df = df.sort_values(by='sort_column') df = df.drop(columns=['sort_column']) diff --git a/index.rst b/index.rst index 3750437f..a2274ce8 100644 --- a/index.rst +++ b/index.rst @@ -1,11 +1,11 @@ -.. geocat-applications documentation master file +.. geocat-applications documentation main file You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. .. module:: geocat.applications .. meta:: - :description: GeoCAT-applications + :description: geocat-applications :keywords: geocat, geocat-applications, geocat applications, wrf, python, wrf-python, weather research and forecasting, @@ -17,9 +17,6 @@ pynio, pyngl, interpolation -.. .. image:: _static/images/nsf.png -.. :scale: 100% -.. :align: right @@ -27,13 +24,14 @@ GeoCAT Applications =================== GeoCAT Applications is a community resource managed by the GeoCAT team. Inspired by the -`NCL Applications `_ page, this is designed to be a quick reference -demonstrating capabilities within the Scientific Python Ecosystem that may be relevant to your geoscience workflows. +`NCL Applications `_ page, GeoCAT Applications is +designed to be a quick reference guide demonstrating capabilities within the scientific +Python ecosystem that may be relevant to your geoscience workflows. New to Python or GeoCAT Applications? Check out the `Getting Started `_ guide! -Python Examples ---------------- +Python Applications +------------------- .. include:: applications/applications.rst @@ -54,25 +52,25 @@ Python Examples :hidden: :caption: Applications - Plot Types - Data Analysis - Date and Time + Geoscience + Math + Time .. toctree:: :maxdepth: 2 :hidden: :caption: NCL to Python - NCL Index - NCL Applications + NCL Index + Examples .. toctree:: :maxdepth: 2 :hidden: :caption: Contributing - Contributor Guide Code of Conduct + Contributor Guide .. toctree:: :maxdepth: 2 diff --git a/python/applications.rst b/python/applications.rst deleted file mode 100644 index da18608a..00000000 --- a/python/applications.rst +++ /dev/null @@ -1,35 +0,0 @@ -.. _applications: - -.. grid:: 3 - :gutter: 2 - - .. grid-item:: - - .. grid:: 1 - :gutter: 1 - - .. card:: Dates and Times - - - `Working with Date and Time `_ - - .. card:: Plot Types - - - .. grid-item:: - - .. grid:: 1 - :gutter: 1 - - .. card:: Data Analysis - - - `General Applied Math `_ - - `Calculating Climatologies `_ - - `Spectral Analysis `_ - - `Humid Heat Metrics `_ - - .. grid-item:: - - .. grid:: 1 - :gutter: 1 - - .. card:: Regridding diff --git a/python/visualization/plot_types.rst b/python/visualization/plot_types.rst deleted file mode 100644 index 13196f65..00000000 --- a/python/visualization/plot_types.rst +++ /dev/null @@ -1,10 +0,0 @@ -.. currentmodule:: geocat.applications - -.. _applications_plot_types: - -Plot Types -========== - -.. toctree:: - :maxdepth: 1 - :hidden: From 580fdc4b4dd6393cc99ecfd6950aeb797c996352 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 25 Oct 2024 10:51:49 -0600 Subject: [PATCH 4/8] initial restructure --- applications/applications.rst | 13 +++++--- .../{geoscience => }/climatology.ipynb | 0 applications/{time => }/datetime.ipynb | 0 .../{math => }/general_applied_math.ipynb | 0 applications/geoscience/geoscience.rst | 12 ------- .../{geoscience => }/humid_heat_metrics.ipynb | 0 applications/math/math.rst | 12 ------- .../{math => }/spectral_analysis.ipynb | 0 applications/time/time.rst | 11 ------- conf.py | 2 +- index.rst | 14 ++++---- .../ncl_entries}/climatology.ipynb | 0 .../ncl_entries}/general_applied_math.ipynb | 0 .../ncl_entries}/meteorology.ipynb | 0 ncl/ncl_entries/ncl_entries.rst | 26 +++++++++++++++ .../ncl_entries}/spectral_analysis.ipynb | 0 .../examples => ncl/ncl_entries}/time.ipynb | 0 .../ncl_entries}/trigonometry.ipynb | 0 .../ncl_index/ncl-index-table.csv | 0 .../ncl_index/ncl_index.rst | 0 {ncl_to_python => ncl}/ncl_raw/cal_dim.ncl | 0 .../ncl_raw/climatology.ncl | 0 .../ncl_raw/daylight_fao56.ncl | 0 .../ncl_raw/dewtemp_trh.ncl | 0 .../ncl_raw/general_applied_math.ncl | 0 .../ncl_raw/trigonometric_functions.ncl | 0 .../receipts/climatology_functions.ipynb | 0 .../receipts/days_in_month.ipynb | 0 .../receipts/general_applied_math.ipynb | 0 .../receipts/meteorology.ipynb | 0 {ncl_to_python => ncl}/receipts/receipts.rst | 0 .../receipts/specx_anal.ipynb | 0 .../receipts/trigonometric_functions.ipynb | 0 ncl_to_python/examples/examples.rst | 33 ------------------- 34 files changed, 41 insertions(+), 82 deletions(-) rename applications/{geoscience => }/climatology.ipynb (100%) rename applications/{time => }/datetime.ipynb (100%) rename applications/{math => }/general_applied_math.ipynb (100%) delete mode 100644 applications/geoscience/geoscience.rst rename applications/{geoscience => }/humid_heat_metrics.ipynb (100%) delete mode 100644 applications/math/math.rst rename applications/{math => }/spectral_analysis.ipynb (100%) delete mode 100644 applications/time/time.rst rename {ncl_to_python/examples => ncl/ncl_entries}/climatology.ipynb (100%) rename {ncl_to_python/examples => ncl/ncl_entries}/general_applied_math.ipynb (100%) rename {ncl_to_python/examples => ncl/ncl_entries}/meteorology.ipynb (100%) create mode 100644 ncl/ncl_entries/ncl_entries.rst rename {ncl_to_python/examples => ncl/ncl_entries}/spectral_analysis.ipynb (100%) rename {ncl_to_python/examples => ncl/ncl_entries}/time.ipynb (100%) rename {ncl_to_python/examples => ncl/ncl_entries}/trigonometry.ipynb (100%) rename {ncl_to_python => ncl}/ncl_index/ncl-index-table.csv (100%) rename {ncl_to_python => ncl}/ncl_index/ncl_index.rst (100%) rename {ncl_to_python => ncl}/ncl_raw/cal_dim.ncl (100%) rename {ncl_to_python => ncl}/ncl_raw/climatology.ncl (100%) rename {ncl_to_python => ncl}/ncl_raw/daylight_fao56.ncl (100%) rename {ncl_to_python => ncl}/ncl_raw/dewtemp_trh.ncl (100%) rename {ncl_to_python => ncl}/ncl_raw/general_applied_math.ncl (100%) rename {ncl_to_python => ncl}/ncl_raw/trigonometric_functions.ncl (100%) rename {ncl_to_python => ncl}/receipts/climatology_functions.ipynb (100%) rename {ncl_to_python => ncl}/receipts/days_in_month.ipynb (100%) rename {ncl_to_python => ncl}/receipts/general_applied_math.ipynb (100%) rename {ncl_to_python => ncl}/receipts/meteorology.ipynb (100%) rename {ncl_to_python => ncl}/receipts/receipts.rst (100%) rename {ncl_to_python => ncl}/receipts/specx_anal.ipynb (100%) rename {ncl_to_python => ncl}/receipts/trigonometric_functions.ipynb (100%) delete mode 100644 ncl_to_python/examples/examples.rst diff --git a/applications/applications.rst b/applications/applications.rst index 0204784c..383e07f7 100644 --- a/applications/applications.rst +++ b/applications/applications.rst @@ -1,18 +1,21 @@ .. _applications: +Python Applications +=================== + .. grid:: 3 :gutter: 2 .. grid-item-card:: Time - - `Working with dates and times `_ + - `Dates and times `_ .. grid-item-card:: Geoscience - - `Calculating climatologies `_ - - `Humid heat metrics `_ + - `Climatology `_ + - `Humid heat metrics `_ .. grid-item-card:: Math - - `General Applied Math `_ - - `Spectral Analysis `_ + - `General applied math `_ + - `Spectral analysis `_ diff --git a/applications/geoscience/climatology.ipynb b/applications/climatology.ipynb similarity index 100% rename from applications/geoscience/climatology.ipynb rename to applications/climatology.ipynb diff --git a/applications/time/datetime.ipynb b/applications/datetime.ipynb similarity index 100% rename from applications/time/datetime.ipynb rename to applications/datetime.ipynb diff --git a/applications/math/general_applied_math.ipynb b/applications/general_applied_math.ipynb similarity index 100% rename from applications/math/general_applied_math.ipynb rename to applications/general_applied_math.ipynb diff --git a/applications/geoscience/geoscience.rst b/applications/geoscience/geoscience.rst deleted file mode 100644 index 303b711e..00000000 --- a/applications/geoscience/geoscience.rst +++ /dev/null @@ -1,12 +0,0 @@ -.. currentmodule:: geocat.applications - -.. _applications_geoscience: - -Geoscience -========== - -.. toctree:: - :maxdepth: 1 - - climatology.ipynb - humid_heat_metrics.ipynb diff --git a/applications/geoscience/humid_heat_metrics.ipynb b/applications/humid_heat_metrics.ipynb similarity index 100% rename from applications/geoscience/humid_heat_metrics.ipynb rename to applications/humid_heat_metrics.ipynb diff --git a/applications/math/math.rst b/applications/math/math.rst deleted file mode 100644 index fd91dd15..00000000 --- a/applications/math/math.rst +++ /dev/null @@ -1,12 +0,0 @@ -.. currentmodule:: geocat.applications - -.. _applications_math: - -Math -==== - -.. toctree:: - :maxdepth: 1 - - general_applied_math.ipynb - spectral_analysis.ipynb diff --git a/applications/math/spectral_analysis.ipynb b/applications/spectral_analysis.ipynb similarity index 100% rename from applications/math/spectral_analysis.ipynb rename to applications/spectral_analysis.ipynb diff --git a/applications/time/time.rst b/applications/time/time.rst deleted file mode 100644 index b8b12187..00000000 --- a/applications/time/time.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. currentmodule:: geocat.applications - -.. _applications_time: - -Time -==== - -.. toctree:: - :maxdepth: 1 - - datetime.ipynb diff --git a/conf.py b/conf.py index 6a98758a..b1ed81f5 100644 --- a/conf.py +++ b/conf.py @@ -26,7 +26,7 @@ os.makedirs(tmp_dir, exist_ok=True) # sort ncl/ncl-index-table.csv -df = pd.read_csv('ncl_to_python/ncl_index/ncl-index-table.csv') +df = pd.read_csv('ncl/ncl_index/ncl-index-table.csv') df['sort_column'] = df['NCL Function'].apply(lambda x: x[1] if len(x) > 1 else x) df = df.sort_values(by='sort_column') df = df.drop(columns=['sort_column']) diff --git a/index.rst b/index.rst index a2274ce8..b91667e1 100644 --- a/index.rst +++ b/index.rst @@ -34,7 +34,7 @@ Python Applications ------------------- .. include:: applications/applications.rst - + :start-line: 5 .. TIP:: If you're looking for NCL to Python examples, please visit :ref:`ncl_applications`. @@ -50,19 +50,17 @@ Python Applications .. toctree:: :maxdepth: 2 :hidden: - :caption: Applications + :caption: Python - Geoscience - Math - Time + Applications .. toctree:: :maxdepth: 2 :hidden: :caption: NCL to Python - NCL Index - Examples + NCL Index + Applications .. toctree:: :maxdepth: 2 @@ -75,7 +73,7 @@ Python Applications .. toctree:: :maxdepth: 2 :hidden: - :caption: Getting Support + :caption: Support GitHub Issues Feature Request Form diff --git a/ncl_to_python/examples/climatology.ipynb b/ncl/ncl_entries/climatology.ipynb similarity index 100% rename from ncl_to_python/examples/climatology.ipynb rename to ncl/ncl_entries/climatology.ipynb diff --git a/ncl_to_python/examples/general_applied_math.ipynb b/ncl/ncl_entries/general_applied_math.ipynb similarity index 100% rename from ncl_to_python/examples/general_applied_math.ipynb rename to ncl/ncl_entries/general_applied_math.ipynb diff --git a/ncl_to_python/examples/meteorology.ipynb b/ncl/ncl_entries/meteorology.ipynb similarity index 100% rename from ncl_to_python/examples/meteorology.ipynb rename to ncl/ncl_entries/meteorology.ipynb diff --git a/ncl/ncl_entries/ncl_entries.rst b/ncl/ncl_entries/ncl_entries.rst new file mode 100644 index 00000000..7791ca33 --- /dev/null +++ b/ncl/ncl_entries/ncl_entries.rst @@ -0,0 +1,26 @@ +.. _ncl_applications: + +NCL to Python Applications +========================== + +NCL to Python examples by function category with relevant context +and links to additional resources and references. + +.. grid:: 3 + :gutter: 2 + + .. grid-item-card:: Time + + - `Dates and times `_ + + .. grid-item-card:: Geoscience + + - `Climatology `_ + - `Meteorology `_ + + .. grid-item-card:: Math + + - `Trigonometry `_ + - `General applied math `_ + - `Spectral analysis `_ + diff --git a/ncl_to_python/examples/spectral_analysis.ipynb b/ncl/ncl_entries/spectral_analysis.ipynb similarity index 100% rename from ncl_to_python/examples/spectral_analysis.ipynb rename to ncl/ncl_entries/spectral_analysis.ipynb diff --git a/ncl_to_python/examples/time.ipynb b/ncl/ncl_entries/time.ipynb similarity index 100% rename from ncl_to_python/examples/time.ipynb rename to ncl/ncl_entries/time.ipynb diff --git a/ncl_to_python/examples/trigonometry.ipynb b/ncl/ncl_entries/trigonometry.ipynb similarity index 100% rename from ncl_to_python/examples/trigonometry.ipynb rename to ncl/ncl_entries/trigonometry.ipynb diff --git a/ncl_to_python/ncl_index/ncl-index-table.csv b/ncl/ncl_index/ncl-index-table.csv similarity index 100% rename from ncl_to_python/ncl_index/ncl-index-table.csv rename to ncl/ncl_index/ncl-index-table.csv diff --git a/ncl_to_python/ncl_index/ncl_index.rst b/ncl/ncl_index/ncl_index.rst similarity index 100% rename from ncl_to_python/ncl_index/ncl_index.rst rename to ncl/ncl_index/ncl_index.rst diff --git a/ncl_to_python/ncl_raw/cal_dim.ncl b/ncl/ncl_raw/cal_dim.ncl similarity index 100% rename from ncl_to_python/ncl_raw/cal_dim.ncl rename to ncl/ncl_raw/cal_dim.ncl diff --git a/ncl_to_python/ncl_raw/climatology.ncl b/ncl/ncl_raw/climatology.ncl similarity index 100% rename from ncl_to_python/ncl_raw/climatology.ncl rename to ncl/ncl_raw/climatology.ncl diff --git a/ncl_to_python/ncl_raw/daylight_fao56.ncl b/ncl/ncl_raw/daylight_fao56.ncl similarity index 100% rename from ncl_to_python/ncl_raw/daylight_fao56.ncl rename to ncl/ncl_raw/daylight_fao56.ncl diff --git a/ncl_to_python/ncl_raw/dewtemp_trh.ncl b/ncl/ncl_raw/dewtemp_trh.ncl similarity index 100% rename from ncl_to_python/ncl_raw/dewtemp_trh.ncl rename to ncl/ncl_raw/dewtemp_trh.ncl diff --git a/ncl_to_python/ncl_raw/general_applied_math.ncl b/ncl/ncl_raw/general_applied_math.ncl similarity index 100% rename from ncl_to_python/ncl_raw/general_applied_math.ncl rename to ncl/ncl_raw/general_applied_math.ncl diff --git a/ncl_to_python/ncl_raw/trigonometric_functions.ncl b/ncl/ncl_raw/trigonometric_functions.ncl similarity index 100% rename from ncl_to_python/ncl_raw/trigonometric_functions.ncl rename to ncl/ncl_raw/trigonometric_functions.ncl diff --git a/ncl_to_python/receipts/climatology_functions.ipynb b/ncl/receipts/climatology_functions.ipynb similarity index 100% rename from ncl_to_python/receipts/climatology_functions.ipynb rename to ncl/receipts/climatology_functions.ipynb diff --git a/ncl_to_python/receipts/days_in_month.ipynb b/ncl/receipts/days_in_month.ipynb similarity index 100% rename from ncl_to_python/receipts/days_in_month.ipynb rename to ncl/receipts/days_in_month.ipynb diff --git a/ncl_to_python/receipts/general_applied_math.ipynb b/ncl/receipts/general_applied_math.ipynb similarity index 100% rename from ncl_to_python/receipts/general_applied_math.ipynb rename to ncl/receipts/general_applied_math.ipynb diff --git a/ncl_to_python/receipts/meteorology.ipynb b/ncl/receipts/meteorology.ipynb similarity index 100% rename from ncl_to_python/receipts/meteorology.ipynb rename to ncl/receipts/meteorology.ipynb diff --git a/ncl_to_python/receipts/receipts.rst b/ncl/receipts/receipts.rst similarity index 100% rename from ncl_to_python/receipts/receipts.rst rename to ncl/receipts/receipts.rst diff --git a/ncl_to_python/receipts/specx_anal.ipynb b/ncl/receipts/specx_anal.ipynb similarity index 100% rename from ncl_to_python/receipts/specx_anal.ipynb rename to ncl/receipts/specx_anal.ipynb diff --git a/ncl_to_python/receipts/trigonometric_functions.ipynb b/ncl/receipts/trigonometric_functions.ipynb similarity index 100% rename from ncl_to_python/receipts/trigonometric_functions.ipynb rename to ncl/receipts/trigonometric_functions.ipynb diff --git a/ncl_to_python/examples/examples.rst b/ncl_to_python/examples/examples.rst deleted file mode 100644 index 1034ae53..00000000 --- a/ncl_to_python/examples/examples.rst +++ /dev/null @@ -1,33 +0,0 @@ -.. _ncl_applications: - -Examples -======== - -NCL to Python examples by function category with relevant context -and links to additional resources and references. - - -Geoscience ----------- -.. toctree:: - :maxdepth: 1 - - climatology.ipynb - meteorology.ipynb - - -Math ----- -.. toctree:: - :maxdepth: 1 - - trigonometry.ipynb - general_applied_math.ipynb - spectral_analysis.ipynb - -Time ----- -.. toctree:: - :maxdepth: 1 - - time.ipynb From 48f8b0f27473d5829ecb5f5baca5ef96fd85052d Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 25 Oct 2024 10:55:11 -0600 Subject: [PATCH 5/8] formatting --- ncl/ncl_entries/ncl_entries.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/ncl/ncl_entries/ncl_entries.rst b/ncl/ncl_entries/ncl_entries.rst index 7791ca33..54c6d3f9 100644 --- a/ncl/ncl_entries/ncl_entries.rst +++ b/ncl/ncl_entries/ncl_entries.rst @@ -23,4 +23,3 @@ and links to additional resources and references. - `Trigonometry `_ - `General applied math `_ - `Spectral analysis `_ - From eb8963d63fa7b80d31978074fcb040eb8b79470d Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 25 Oct 2024 12:04:07 -0600 Subject: [PATCH 6/8] update suggestion form name --- index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.rst b/index.rst index b91667e1..f529ee83 100644 --- a/index.rst +++ b/index.rst @@ -76,4 +76,4 @@ Python Applications :caption: Support GitHub Issues - Feature Request Form + Suggestion Box From 23a04c7bf60117df6d917bebb2b48f77b19374cb Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 25 Oct 2024 12:46:24 -0600 Subject: [PATCH 7/8] change back to old grid approach --- applications/applications.rst | 33 +++++++++++++++++++++++-------- ncl/ncl_entries/ncl_entries.rst | 35 +++++++++++++++++++++++---------- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/applications/applications.rst b/applications/applications.rst index 383e07f7..4967ea60 100644 --- a/applications/applications.rst +++ b/applications/applications.rst @@ -3,19 +3,36 @@ Python Applications =================== +Python resources by function category with relevant context and links to additional resources and references. + .. grid:: 3 :gutter: 2 - .. grid-item-card:: Time + .. grid-item:: + + .. grid:: 1 + :gutter: 1 + + .. card:: Time + + - `Dates and times `_ + + .. grid-item:: + + .. grid:: 1 + :gutter: 1 + + .. card:: Math - - `Dates and times `_ + - `General applied math `_ + - `Spectral analysis `_ - .. grid-item-card:: Geoscience + .. grid-item:: - - `Climatology `_ - - `Humid heat metrics `_ + .. grid:: 1 + :gutter: 1 - .. grid-item-card:: Math + .. card:: Geoscience - - `General applied math `_ - - `Spectral analysis `_ + - `Climatology `_ + - `Humid heat metrics `_ diff --git a/ncl/ncl_entries/ncl_entries.rst b/ncl/ncl_entries/ncl_entries.rst index 54c6d3f9..7ebbc936 100644 --- a/ncl/ncl_entries/ncl_entries.rst +++ b/ncl/ncl_entries/ncl_entries.rst @@ -3,23 +3,38 @@ NCL to Python Applications ========================== -NCL to Python examples by function category with relevant context +NCL to Python resources by function category with relevant context and links to additional resources and references. .. grid:: 3 :gutter: 2 - .. grid-item-card:: Time + .. grid-item:: - - `Dates and times `_ + .. grid:: 1 + :gutter: 1 - .. grid-item-card:: Geoscience + .. card:: Time - - `Climatology `_ - - `Meteorology `_ + - `Dates and times `_ - .. grid-item-card:: Math + .. grid-item:: - - `Trigonometry `_ - - `General applied math `_ - - `Spectral analysis `_ + .. grid:: 1 + :gutter: 1 + + .. card:: Math + + - `Trigonometry `_ + - `General applied math `_ + - `Spectral analysis `_ + + .. grid-item:: + + .. grid:: 1 + :gutter: 1 + + .. card:: Geoscience + + - `Climatology `_ + - `Meteorology `_ From 283cdbc115c969e1eda682e8030d897dab885341 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 25 Oct 2024 12:48:14 -0600 Subject: [PATCH 8/8] update applications description --- applications/applications.rst | 2 +- ncl/ncl_entries/ncl_entries.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/applications.rst b/applications/applications.rst index 4967ea60..cc5eadcf 100644 --- a/applications/applications.rst +++ b/applications/applications.rst @@ -3,7 +3,7 @@ Python Applications =================== -Python resources by function category with relevant context and links to additional resources and references. +Python resources by category with relevant context and links to additional resources and references. .. grid:: 3 :gutter: 2 diff --git a/ncl/ncl_entries/ncl_entries.rst b/ncl/ncl_entries/ncl_entries.rst index 7ebbc936..6c03b81c 100644 --- a/ncl/ncl_entries/ncl_entries.rst +++ b/ncl/ncl_entries/ncl_entries.rst @@ -3,7 +3,7 @@ NCL to Python Applications ========================== -NCL to Python resources by function category with relevant context +NCL to Python resources by category with relevant context and links to additional resources and references. .. grid:: 3