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

feat: update the readme #88

Merged
merged 1 commit into from
Dec 6, 2023
Merged
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
99 changes: 88 additions & 11 deletions scripts/src/wgrib2/readme.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,105 @@
# Data is in grib2 format, need the wgrib2 to read the file
# Running Climate Forecast Script (cmc)

* for now can just build the component on every run to get up and running
* shortly after should cache an artifact and only build if the artifact doesn't
exist.
## Background

The cmc scripts will:
* download the data from the environment canada hpfx server
* extract the grib2 data into the various T1... T4, and P1 ... P4 files

# local install
Each file contains a series of lat longs and values for data that has been
extracted from the grib2 data.


## Prerequisites

The script requires the wgrib2 binary to extract data from the various grib2
formatted files.

The github action run is tied to this repository which has a cached binary
artifact with the grib2 binary compiled for x86 linux as well as github
actions to build the various artifacts.

https://github.com/franTarkenton/wgrib2-Cygwin-Build

The actions will grab the binary from the repo, however when running locally
you will have to either download the binary (if running under WSL), or compile
it yourself.



### Compile WGRIB2 Utility - Local development

To run / debug the scripts locally you will need a binary wgrib2 utility.

* Navigate to the wgrib folder
```
cd scripts/src/wgrib2
```

* get the source code, extract it, and change to that directory
```
wget -c ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz
tar -xzvf wgrib2.tgz
cd grib2
```

* Ensure you have the required dependencies

``` sh
sudo apt install -y build-essential libaec-dev zlib1g-dev libcurl4-openssl-dev libboost-dev curl wget zip unzip bzip2 gfortran gcc g++ cmake
```

* set compiler flag env vars and compile
```
export CC=gcc
export FC=gfortran
make
# test
grib2/wgrib2 -config
# use
export PATH=$PATH;$(pwd)/grib2
```

or just get the binary
* copy the binary to the expected directory

```
cp wgrib2/wgrib2 ../.

```

* verify that things are setup

```
# return the the root of the project directory
cd ../../../../

# update paths
export PATH=$PATH:$(pwd)/scripts/src/wgrib2

# test the binary - should return usage details.
wgrib2
```

* cleanup - assuming working
```
rm -rf ./scripts/src/wgrib2/grib2
```

### Download the Binary

or... rather than compile you can just download the binary from the repo
mentioned previously

* download the binary

```
curl -L -o scripts/src/wgrib2/wgrib2 https://github.com/franTarkenton/wgrib2-Cygwin-Build/releases/download/20230203-0000/wgrib2
```

* set the executable flag, and add dir to PATHS
```
chmod +x scripts/src/wgrib2/wgrib2
export PATH=$PATH:$(pwd)/scripts/src/wgrib2
```

* test
```
curl -L -o wgrib2 https://github.com/franTarkenton/wgrib2-Cygwin-Build/releases/download/20230203-0000/wgrib2
wgrib2
```

Loading