Skip to content

Commit

Permalink
Update to version 2.0.2
Browse files Browse the repository at this point in the history
Fixed bug that didn't take --cmap argument

Added license page in documentation site

Added documentation to explain the use of --clevels option

Added documentation section about use of --ulevels option

Update to readthedoc build which was failing earlier
  • Loading branch information
wxguy committed Jul 30, 2024
1 parent 620e9cc commit 795c032
Show file tree
Hide file tree
Showing 12 changed files with 163 additions and 65 deletions.
14 changes: 14 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Read the Docs configuration file for MkDocs projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

mkdocs:
configuration: mkdocs.yml
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Details of PyPi package [![PyPI Version](https://badge.fury.io/py/ansicolortags.

Status of builds ![Build and Release](https://github.com/wxguy/wrfplot/actions/workflows/release-github.yaml/badge.svg) ![PyPi Package](https://github.com/wxguy/wrfplot/actions/workflows/release-pip.yaml/badge.svg)

Conda details ![Conda Version](https://anaconda.org/conda-forge/wrfplot/badges/version.svg) ![Last updated on](https://anaconda.org/conda-forge/wrfplot/badges/latest_release_date.svg) ![Works on Windows, Linux and Mac](https://anaconda.org/conda-forge/wrfplot/badges/platforms.svg) ![Download Counts](https://anaconda.org/conda-forge/wrfplot/badges/downloads.svg)
Conda details ![Conda Version](https://img.shields.io/conda/v/conda-forge/wrfplot) ![Last updated on](https://anaconda.org/conda-forge/wrfplot/badges/latest_release_date.svg) ![Works on Windows, Linux and Mac](https://anaconda.org/conda-forge/wrfplot/badges/platforms.svg) ![Download Counts](https://img.shields.io/conda/dn/conda-forge/wrfplot)

## About wrfplot

Expand All @@ -20,7 +20,7 @@ The idea of developing wrfplot came to my mind as I frequently revisit the same

## Documentation

Documentation of this project is located at https://wrfplot.readthedocs.io.
Documentation of this project is located at https://wxguy.in/wrfplot.

## Use Cases

Expand All @@ -43,11 +43,11 @@ wrfplot --version

## Binary (standalone) Installation

Since it is intended to be used as command line, the application is also distributed as stand-alone on both Linux and Windows. You must download the correct version of application installer or setup file. Both are described below:
Since it is intended to be used as a command line, the application is also distributed as stand-alone on both Linux and Windows. You must download the correct version of application installer or setup file. Both are described below:

### Windows Only

Go to https://github.com/wxguy/wrfplot/releases and look for latest release. The Windows setup executable will have name `wrfplot-windows-64bit.exe`. Click on the link and download it to local disk. The rest of the installation procedure is same as you do for any other windows setup files. Once installed Check if installation is successful by typing following command in `cmd` window which should not produce any errors:
Go to https://github.com/wxguy/wrfplot/releases and look for the latest release. The Windows setup executable will have name `wrfplot-windows-64bit.exe`. Click on the link and download it to local disk. The rest of the installation procedure is same as you do for any other windows setup files. Once installed Check if installation is successful by typing following command in `cmd` window which should not produce any errors:

```
wrfplot --version
Expand Down
26 changes: 22 additions & 4 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,27 @@ Here are the following dependencies you should know about before installing wrfp

* Architecture: x86_64 or simple called 64bit. **_Don't download if you have 32bit machine_**. It won't work.

## Install on Windows, Linux and macOS

Support for all platforms is provided through conda-forge.
If you have already conda installed, then the following command is enough to install wrfplot:

```commandline
conda install -c cond-forge wrfplot
```

Check your installation by typing the following command which should show the version number:

```commandline
wrfplot --version
2.0.2
```

## Standalone (Binary) Installation

Since it is intended to be used as a command line, the application is distributed as stand-alone on both Linux and Windows. You must download the correct version of application installer or setup file. Both are described in the subsection below.

## Installation under Windows
### Installation under Windows
Go to [https://github.com/wxguy/wrfplot/releases](https://github.com/wxguy/wrfplot/releases) and look for the latest release. The Windows setup executable will have name `wrfplot-windows-64bit.exe` and download it to the local disk. The rest of the installation procedure is same as you do for any other windows setup files. Here are the complete process of installing in visual format:

<figure markdown="span">
Expand Down Expand Up @@ -53,12 +71,12 @@ Go to [https://github.com/wxguy/wrfplot/releases](https://github.com/wxguy/wrfpl

<figure markdown="span">
![Image title](static/images/screenshots/8-windows-install-finish.png )
<figcaption>Windows Finish Screen</figcaption>
<figcaption>Click Finish to Close Setup</figcaption>
</figure>

That’s it. You have successfully installed `wrfplot`.

## Installation under Linux
### Installation under Linux

Go to [https://github.com/wxguy/wrfplot/releases](https://github.com/wxguy/wrfplot/releases) and look for the latest release. The Linux installer will have name wrfplot-linux-64bit.run. Click on the link and download it to local disk. Thereafter, execute the below command (assuming that the Linux installer is downloaded at ~/Downloads):

Expand All @@ -81,7 +99,7 @@ Updating .bashrc file to include install directory...
Installation completed. Please restart your terminal to continue using wrfplot...
```

## Installation under macOS
### Installation under macOS

There is no binary distribution made available for macOS at the moment. The support for macOS is provided through miniconda. If you already have miniconda/ anaconda installed, you can execute the following to install `wrfplot`:

Expand Down
5 changes: 5 additions & 0 deletions docs/license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
wrfplot is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

wrfplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with wrfplot. If not, see <http://www.gnu.org/licenses/>.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 85 additions & 5 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Basic Usage

The first step in plotting diagnostic variable to find what all variables are supported by wrfplot application. This is required as the application would accept variable names only in certain string format. Therefore, you should list and review the name of variable by issuing the following command in the terminal:
The first step in plotting diagnostic variable to find what all variables are supported by wrfplot application.
This is required as the application would accept variable names only in certain string format.
Therefore, you should list and review the name of variable by issuing the following command in the terminal:

```console
$ wrfplot --list-vars
Expand Down Expand Up @@ -51,8 +53,12 @@ Variable "u_cin" --> Convective Inhibition ($J kg^{1}$)
Variable "u_cape" --> Convective Available Potential Energy ($J kg^{1}$)
```

The above console print has two names. One with quote and the other is without. The name within quote such as "slp" is called short variable, and without a quote is called long variable. You can read through a list to take note of what parameter you want to plot. For example, if you need to plot `2m Relative Humidity`, then you need to remember the sort variable name in the first quote “” i.e, `“rh2”`. With this, we will proceed ahead to plot “rh2” variable.
To plot any variable, there are minimum three arguments are to be provided. They are `--vars`, `--input` and `--output`. Details of this would be discussed later.
The above console print has two names. One with quote and the other is without.
The name within quote such as "slp" is called short variable, and without a quote is called long variable.
You can read through a list to take note of what parameter you want to plot.
For example, if you need to plot `2m Relative Humidity`, then you need to remember the sort variable name in the first quote “” i.e, `“rh2”`.
With this, we will proceed ahead to plot “rh2” variable. To plot any variable, there are minimum three arguments required to be provided.
They are `--vars`, `--input` and `--output`. Details of these would be discussed later.

## Plotting Surface Variable

Expand Down Expand Up @@ -96,7 +102,10 @@ The plotted output for variable will look like below:

## Plotting Upper Atmospheric Variables

`wrfplot` supports a few upper atmospheric variables. These variables are indicated with u_ tag for ease of identification. By default, the plot for upper atmospheric variables would be plotted for 925, 850, 700, 600, 500, 400, 300 & 200hPa. The upper levels can be controlled using --ulevels though. If you want to plot upper winds, you can specify the variable with following command:
`wrfplot` supports a few upper atmospheric variables. These variables are indicated with u_ tag for ease of identification.
By default, the plot for upper atmospheric variables would be plotted for `925`, `850`, `700`, `600`, `500`, `400`, `300` & `200` hPa.
The upper levels can be controlled using `--ulevels` though.
If you want to plot upper winds, you can specify the variable with the following command:

```console
$ wrfplot --vars "u_winds" --input ../../test/wrfout_data/wrfout_d01_2021-05-13_00_00_00 --output ../../test/wrfout_data/output_images
Expand All @@ -107,7 +116,48 @@ $ wrfplot --vars "u_winds" --input ../../test/wrfout_data/wrfout_d01_2021-05-13_
<figcaption>Sample Upper Winds Plot at 300hPa</figcaption>
</figure>

## Creating Animation to Plots
## Plot Variable at Specific Level(s)

When plotting upper level variable, `wrfplot` will plot all the predefined levels viz., `925`, `850`, `700`, `600`, `500`, `400`, `300` & `200` hPa.
You can control the level at which variable is required to be plotted using `--ulevels` argument.
For example, if you need to plot at `800` and `750` hpa levels only, then you can apply the following command:

```console
$ wrfplot --vars "u_winds" --ulevels "800,750" --input ../../test/wrfout_data/wrfout_d01_2021-05-13_00_00_00 --output ../../test/wrfout_data/output_images
```

Remember that the level values are to be separated by `,`. That should produce the following output in the terminal:

```console
Using user provided upper level(s) : "800.0,750.0"

*** Initialising plotting for variable : "u_winds" ***

Plotting "u_winds" for level "800.0" hPa and Time : "13-05-2021_05:30" UTC
Image saved at : "../../test/wrfout_data/output_images/u_winds_800.0_13-05-2021_05_30.png"
Plotting "u_winds" for level "800.0" hPa and Time : "13-05-2021_08:30" UTC
Image saved at : "../../test/wrfout_data/output_images/u_winds_800.0_13-05-2021_08_30.png"
Plotting "u_winds" for level "800.0" hPa and Time : "13-05-2021_11:31" UTC
Image saved at : "../../test/wrfout_data/output_images/u_winds_800.0_13-05-2021_11_31.png"
Plotting "u_winds" for level "800.0" hPa and Time : "13-05-2021_14:30" UTC
Image saved at : "../../test/wrfout_data/output_images/u_winds_800.0_13-05-2021_14_30.png"
Plotting "u_winds" for level "800.0" hPa and Time : "13-05-2021_17:30" UTC
Image saved at : "../../test/wrfout_data/output_images/u_winds_800.0_13-05-2021_17_30.png"
Plotting "u_winds" for level "750.0" hPa and Time : "13-05-2021_05:30" UTC
Image saved at : "../../test/wrfout_data/output_images/u_winds_750.0_13-05-2021_05_30.png"
Plotting "u_winds" for level "750.0" hPa and Time : "13-05-2021_08:30" UTC
Image saved at : "../../test/wrfout_data/output_images/u_winds_750.0_13-05-2021_08_30.png"
Plotting "u_winds" for level "750.0" hPa and Time : "13-05-2021_11:31" UTC
Image saved at : "../../test/wrfout_data/output_images/u_winds_750.0_13-05-2021_11_31.png"
Plotting "u_winds" for level "750.0" hPa and Time : "13-05-2021_14:30" UTC
Image saved at : "../../test/wrfout_data/output_images/u_winds_750.0_13-05-2021_14_30.png"
Plotting "u_winds" for level "750.0" hPa and Time : "13-05-2021_17:30" UTC
Image saved at : "../../test/wrfout_data/output_images/u_winds_750.0_13-05-2021_17_30.png"
Plotting process completed. It took 0H:0M:6.948402S
```

## Create Animation (GIF)

You can also create an animation of your plots using `--gif` option. Example command is given below:

Expand All @@ -122,6 +172,8 @@ This would produce an animated `gif` image as shown below:
<figcaption>Sample Animation Plot</figcaption>
</figure>

## Control Animation Speed

By default, the speed of the animation is kept as `0.5` sec. If you wish to increase or decrease the speed, you can do so by with `--gif-speed` option as indicated below where speed is increased to `0.25` sec:

```console
Expand All @@ -134,3 +186,31 @@ This would increase the speed of animation as shown in the sample image file.
![Image title](static/images/rh2-13-05-2021_05_30_faster.gif)
<figcaption>Animation Plot with Increased Speed</figcaption>
</figure>

## Control Contour Levels

The default contour levels of each variable set based on a variable type.
For example, `Relative Humidity` variable will have 10 levels from 0 to 100 with an interval of 10.
If you wish to change these intervals for specific variable, you may do so with `--clevels` argument.
Levels are to be in ascending order and separated by ','.
For example, `24,26,28,30,32,34,36`.
Example plot to change temperature level to highlight the temperature range of interest will be as follows:

```console
$ wrfplot --vars "rh2" --clevels '0,10,20,30,32,34,36,38,40,42,44,46' --input ../../test/wrfout_data/wrfout_d01_2021-05-13_00_00_00 --output ../../test/wrfout_data/output_images
```

After executing the command with `--clevels` argument, the plot would look like this:

<figure markdown="span">
![Image title](static/images/T2_13-05-2021_17_30_clevels.png)
<figcaption>T2 Plot with Custom `--clevels` Option</figcaption>
</figure>

this can be compared with the default clevels set by the `wrfplot` as shown below:

<figure markdown="span">
![Image title](static/images/T2_13-05-2021_17_30.png)
<figcaption>T2 Plot with Default `--clevels` Option</figcaption>
</figure>

2 changes: 1 addition & 1 deletion installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
; Define the path to directory where Nutika put all our application files and directories
!define PY_APP_DIR "build\windows\wrfplot"
!define PRODUCT_NAME "wrfplot"
!define PRODUCT_VERSION "2.0.0"
!define PRODUCT_VERSION "2.0.2"
!define BITNESS "64"
!define ARCH_TAG ".amd64"
!define INSTALLER_NAME "wrfplot-windows-64bit.exe"
Expand Down
5 changes: 3 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ site_url: https://wxguy.github.io/wrfplot
nav:
- Home: index.md
- Installation: install.md
- Supported Variables: variable-list.md
- Variables : variable-list.md
- Usage: usage.md
- Supported Colormaps: colormaps.md
- Colormaps: colormaps.md
- Support: support.md
- Contribution: contribution.md
- Authors: authors.md
- License: license.md

theme:
name: material
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def my_release_branch_semver_version(version):
# cmdclass={ 'upload': UploadCommand,},
project_urls={
"Bug Reports": "https://github.com/wxguy/wrfplot/issues",
"Source": "https://github.com/wxguy/wrfplot/",
"Documentation": "https://wrfplot.readthedocs.io"
"Source": "https://github.com/wxguy/wrfplot",
"Documentation": "https://wxguy.in/wrfplot"
},
)
21 changes: 7 additions & 14 deletions wrfplot/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def dir_path(path):
str: if path is valid or else ArgumentTypeError
"""

# Convert Linux's '~' to absolute path to make it workable
# Convert Linux's '~' to an absolute path to make it workable
if path.startswith("~"):
path = os.path.expanduser(path)
previous_dir = os.path.dirname(path)
Expand All @@ -48,10 +48,10 @@ def dir_path(path):


def file_path(path):
"""Validate if input file provided exist
"""Validate if an input file provided exists
Args:
path: Path to input file
path: Path to an input file
Results:
str: if path is valid or else ArgumentTypeError
Expand All @@ -72,7 +72,7 @@ def validate_vars(input_vars):
input_vars (list): List of variables for plotting
Results:
list: list of variable after omitting names not known to application
list: list of variables after omitting names not known to application
"""

final_vars = []
Expand Down Expand Up @@ -131,14 +131,7 @@ def list_cmaps():
cmap_methods = dir(cmaps)
print(cmap_methods)
return cmap_methods
"""
for method in cmap_methods:
try:
if getattr(cmaps, method):
print(method)
except AttributeError:
pass
"""


def validate_cmap(cmap):
"""Validate user colormap name
Expand Down Expand Up @@ -195,7 +188,7 @@ def validate_ulevels(ulevels):

if len(filtered_ulevels) > 0:
output_str_lst = [str(x) for x in filtered_ulevels]
print("Using user provided upper level(s) : " + utils.quote(",".join(output_str_lst)))
print("\nUsing user provided upper level(s) : " + utils.quote(",".join(output_str_lst)))
return filtered_ulevels
else:
print("\nNone of the levels are valid upper levels.")
Expand Down Expand Up @@ -238,7 +231,7 @@ def validate_clevels(clevels):
return False
else:
output_str_lst = [str(x) for x in filtered_clevels]
print("Using user provided contour levels : " + utils.quote(",".join(sorted(output_str_lst))))
print("\nUsing user provided contour levels : " + utils.quote(",".join(sorted(output_str_lst))))
return sorted(filtered_clevels)


Expand Down
Loading

0 comments on commit 795c032

Please sign in to comment.