Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to Github links #1

Merged
merged 7 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ include:
- project: 'modulus/modulus-ci'
ref: earth-2
file: '.gitlab-ci/earth2/studio/wheel.gitlab-ci.yml'

- project: 'modulus/modulus-ci'
ref: earth-2
file: '.gitlab-ci/earth2/studio/docs.gitlab-ci.yml'
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Our mission is to enable everyone to build, research and explore AI driven meteo
**- Earth-2 Studio Documentation -**
<!-- markdownlint-enable MD036 -->

[Home](e2studio_docs_url) | [User-Guide](e2studio_userguide_url) |
[Install](e2studio_install_url) | [User-Guide](e2studio_userguide_url) |
[Examples](e2studio_examples_url) | [API](e2studio_api_url)

</div>
Expand All @@ -25,7 +25,7 @@ Our mission is to enable everyone to build, research and explore AI driven meteo
Install Earth-2 Studio from source:

```bash
git clone https://gitlab-master.nvidia.com/modulus/earth-2/earth2-inference-studio.git
git clone https://github.com/NVIDIA/earth2studio.git

cd earth2-inference-studio

Expand Down Expand Up @@ -85,11 +85,12 @@ Earth-2 Inference Studio is provided under the Apache License 2.0, please see
[e2studio_format_url]: https://github.com/psf/black

<!-- Doc links -->
[e2studio_docs_url]: https://www.python.org/downloads/
[e2studio_userguide_url]: https://www.python.org/downloads/
[e2studio_examples_url]: https://www.python.org/downloads/
[e2studio_api_url]: https://www.python.org/downloads/
[e2studio_customization_url]: https://www.python.org/downloads/
[e2studio_docs_url]: https://nvidia.github.io/earth2studio/
[e2studio_install_url]: https://nvidia.github.io/earth2studio/install/
[e2studio_userguide_url]: https://nvidia.github.io/earth2studio/userguide/
[e2studio_examples_url]: https://nvidia.github.io/earth2studio/examples/
[e2studio_api_url]: https://nvidia.github.io/earth2studio/modules/
[e2studio_customization_url]: https://nvidia.github.io/earth2studio/

<!-- Misc links -->
[modulus_repo_url]: https://github.com/NVIDIA/modulus
2 changes: 1 addition & 1 deletion docs/_static/switcher.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"preferred": true
},
{
"name": "0.1.0 (alpha)",
"name": "0.1.0",
"version": "0.1.0",
"url": "https://nvidia.github.io/earth2studio/v/0.1.0/"
}
Expand Down
29 changes: 14 additions & 15 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,31 +80,30 @@
"css/custom.css",
]
html_theme_options = {
"announcement": "Earth-2 Inference Studio is in Alpha!",
"announcement": "Earth-2 Inference Studio is now OSS!",
"logo": {
"text": "Earth-2 Inference Studio",
"image_light": "_static/NVIDIA-Logo-V-ForScreen-ForLightBG.png",
"image_dark": "_static/NVIDIA-Logo-V-ForScreen-ForDarkBG.png",
},
"navbar_start": ["navbar-logo"],
"navbar_align": "left",
# "navbar_start": ["navbar-logo", "version-switcher"],
# "switcher": {
# "json_url": "https://raw.githubusercontent.com/NVIDIA/earth2-inference-studio/gh-pages/_static/switcher.json",
# "version_match": doc_version, # Set DOC_VERSION env variable to change
# },
# "external_links": [
# {
# "name": "Changelog",
# "url": "https://gitlab-master.nvidia.com/modulus/earth-2/earth2-inference-studio/blob/main/CHANGELOG.md",
# },
# ],
"navbar_start": ["navbar-logo", "version-switcher"],
"switcher": {
"json_url": "https://gitlab-master.nvidia.com/modulus/earth-2/earth2studio/-/raw/5dae5dbe2795b790d6b84f28b730be2821dd0e71/_static/switcher.json",
"version_match": doc_version, # Set DOC_VERSION env variable to change
},
"external_links": [
{
"name": "Changelog",
"url": "https://gitlab-master.nvidia.com/modulus/earth-2/earth2-inference-studio/blob/main/CHANGELOG.md",
},
],
"icon_links": [
{
# Label for this link
"name": "Gitlab",
"name": "Github",
# URL where the link will redirect
"url": "https://gitlab-master.nvidia.com/modulus/earth-2/earth2-inference-studio", # required
"url": "https://github.com/NVIDIA/earth2studio", # required
# Icon class (if "type": "fontawesome"), or path to local image (if "type": "local")
"icon": "fa-brands fa-square-github",
# The type of image to be used (see below for details)
Expand Down
4 changes: 2 additions & 2 deletions docs/install/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pip install earth2studio
To install the latest main branch version of Earth2Studio:

```bash
git clone https://gitlab-master.nvidia.com/modulus/earth-2/earth2-inference-studio.git
git clone https://github.com/NVIDIA/earth2studio.git

cd earth2-inference-studio

Expand Down Expand Up @@ -57,7 +57,7 @@ Use the optional install commands to add these dependencies.
For developers, use an edittable install of Earth-2 Studio with the `dev` option:

```bash
git clone https://gitlab-master.nvidia.com/modulus/earth-2/earth2-inference-studio.git
git clone https://github.com/NVIDIA/earth2studio.git

cd earth2-inference-studio

Expand Down
6 changes: 2 additions & 4 deletions examples/02_ensemble_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def run_ensemble(
x, coords = fetch_data(
source=data,
time=time,
lead_time=prognostic.input_coords["lead_time"],
variable=prognostic.input_coords["variable"],
device=device,
)
Expand All @@ -132,10 +133,7 @@ def run_ensemble(
# Set up IO backend
total_coords = coords.copy()
total_coords["lead_time"] = np.asarray(
[
coords["lead_time"] + prognostic.output_coords["lead_time"] * i
for i in range(nsteps + 1)
]
[prognostic.output_coords["lead_time"] * i for i in range(nsteps + 1)]
).flatten()

var_names = total_coords.pop("variable")
Expand Down
31 changes: 15 additions & 16 deletions examples/04_ensemble_workflow_extend.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@

# %%
"""
Running Ensemble Inference
==========================
Single Variable Perturbation Method
===================================

Intermediate ensemble inference workflow.
Intermediate ensemble inference using a custom perturbation method.

This example will demonstrate how to run a an ensemble inference workflow
with a custom perturbation method.
with a custom perturbation method that only applies noise to a specific variable.

In this example you will learn:

- How to extend an existing pertubration method
- How to instantiate a built in prognostic model
- Creating a data source and IO object
- Running a simple built in workflow
Expand Down Expand Up @@ -119,6 +120,7 @@ def run_ensemble(
x, coords = fetch_data(
source=data,
time=time,
lead_time=prognostic.input_coords["lead_time"],
variable=prognostic.input_coords["variable"],
device=device,
)
Expand All @@ -131,10 +133,7 @@ def run_ensemble(
# Set up IO backend
total_coords = coords.copy()
total_coords["lead_time"] = np.asarray(
[
coords["lead_time"] + prognostic.output_coords["lead_time"] * i
for i in range(nsteps + 1)
]
[prognostic.output_coords["lead_time"] * i for i in range(nsteps + 1)]
).flatten()

var_names = total_coords.pop("variable")
Expand Down Expand Up @@ -168,7 +167,7 @@ def run_ensemble(
#
# We need the following:
#
# - Prognostic Model: Use the built in FourCastNet model :py:class:`earth2studio.models.px.FCN`.
# - Prognostic Model: Use the built in DLWP model :py:class:`earth2studio.models.px.DLWP`.
# - perturbation_method: Extend the Spherical Gaussian Method :py:class:`earth2studio.perturbation.SphericalGaussian`.
# - Datasource: Pull data from the GFS data api :py:class:`earth2studio.data.GFS`.
# - IO Backend: Lets save the outputs into a Zarr store :py:class:`earth2studio.io.ZarrBackend`.
Expand All @@ -179,25 +178,25 @@ def run_ensemble(
from collections import OrderedDict
from typing import Union, List

from earth2studio.models.px import FCN
from earth2studio.models.px import DLWP
from earth2studio.perturbation import PerturbationMethod, SphericalGaussian
from earth2studio.data import GFS
from earth2studio.io import ZarrBackend
from earth2studio.utils.type import CoordSystem

# Load the default model package which downloads the check point from NGC
package = FCN.load_default_package()
model = FCN.load_model(package)
package = DLWP.load_default_package()
model = DLWP.load_model(package)

# Create the data source
data = GFS()

# Instantiate the pertubation method
# %%
# The perturbation method in 02_ensemble_workflow.py is naive because it applies the
# same noise amplitude to every variable. We can create a custom wrapper that only
# applies the perturbation method to a particular variable instead.


# %%
class ApplyToVariable:
"""Apply a perturbation to only a particular variable."""

Expand Down Expand Up @@ -277,7 +276,7 @@ def plot_(axi, data, title, cmap):
axi.gridlines()


for variable, cmap in zip(["t2m", "tcvw"], ["coolwarm", "Blues"]):
for variable, cmap in zip(["t2m", "tcwv"], ["coolwarm", "Blues"]):
step = 0 # lead time = 24 hrs

plt.close("all")
Expand Down Expand Up @@ -308,4 +307,4 @@ def plot_(axi, data, title, cmap):
cmap,
)

plt.savefig(f"outputs/02_{forecast}_{variable}_{step}_ensemble.jpg")
plt.savefig(f"outputs/04_{forecast}_{variable}_{step}_ensemble.jpg")
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ readme = "README.md"
requires-python = ">=3.10"
license = {text = "Apache 2.0"}
dependencies = [
"boto3>=1.26.0",
"boto3>=1.34.50",
"cdsapi >= 0.6.1",
"cfgrib >= 0.9.10.3",
"cftime",
Expand Down