diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eeae43..8c53df6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +### 0.4.1 +- Binary build for `linux-arm64` has been added as part of release +- Enhanced error reporting + +Build Support Matrix: +| OS \ ARCH | AMD64 | ARM64 | +| :------------- | :---------: | :---------: | +| **Linux** | ✅ | ✅ | +| **MacOS** | | ✅ | +| **Windows** | ✅ | | + ### 0.4.0 *Compatible with outputs from Ripple1D Pipeline version 0.10.3 to present* @@ -20,10 +31,8 @@ ### 0.2.1 -*Compatible with outputs from Ripple1D version unknown to 0.7.0* - - Fix bug that was assuming no data value -9999.0 for all raster types, the no data value is now inferred from FIM library rasters -- An error is raised in `fim` command when control file is empty +- An error is raised in `fim` command when controls file is empty ### 0.2.0 *Compatible with outputs from Ripple1D pipeline version unknown to 0.7.0* diff --git a/INSTALL.md b/INSTALL.md index 14eb124..b3c8653 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -46,7 +46,7 @@ 2. **Setup flows2fim** - **Option 1 - Download** - - Go to the [**Releases**](https://github.com/NGWPC/flows2fim/releases) page and download the `flows2fim-linux-amd64.tar.gz` + - Go to the [**Releases**](https://github.com/NGWPC/flows2fim/releases) page and download the `flows2fim-linux-.tar.gz` - Extract it and move to a directory in `$PATH` (e.g., `/usr/local/bin`) and make it executable: ```bash tar -xvf flows2fim-linux-amd64.tar.gz @@ -122,7 +122,7 @@ ```bash xattr -d com.apple.quarantine /usr/local/bin/flows2fim ``` - + - **Option 2 - Build from source** - cd into root of repository - Build container diff --git a/README.md b/README.md index 1bff499..d6fd37e 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Current support is for English units. The flow values must be in `cfs` 1. Download Baxter sample data from ` s3://fimc-data/flows2fim/sample_data/v0_2_0/Baxter` if you don't have a dataset already. -1. To create a control file from the 100yr flows file run `flows2fim controls -db "Baxter/ripple.gpkg" -f "Baxter/flows/flows_100yr_cfs.csv" -o "Baxter/controls_100yr.csv" -sids 2821866` +1. To create a controls file from the 100yr flows file run `flows2fim controls -db "Baxter/ripple.gpkg" -f "Baxter/flows/flows_100yr_cfs.csv" -o "Baxter/controls_100yr.csv" -sids 2821866` 1. To create Depth VRT run `flows2fim fim -lib "Baxter/library" -type depth -c "Baxter/controls_100yr.csv" -o "Baxter/fim_100yr.vrt"` diff --git a/cmd/domain/domain.go b/cmd/domain/domain.go index f7204b9..37c08c9 100644 --- a/cmd/domain/domain.go +++ b/cmd/domain/domain.go @@ -52,7 +52,7 @@ func Run(args []string) (gdalArgs []string, err error) { // Define flags using flags.StringVar flags.StringVar(&fimLibDir, "lib", "", "Directory containing FIM Library. GDAL VSI paths can be used, given GDAL must have access to cloud creds") - flags.StringVar(&reachesFile, "r", "", "Path to the reaches list CSV file (control file can also be used as long as first column is reach_id)") + flags.StringVar(&reachesFile, "r", "", "Path to the reaches list CSV file (controls file can also be used as long as first column is reach_id)") flags.StringVar(&outputFormat, "fmt", "VRT", "Output format: 'VRT', 'COG' or 'GTIFF'") // follows GDAL format names, case insensitive flags.StringVar(&outputFile, "o", "", "Output domain file path") diff --git a/cmd/fim/fim.go b/cmd/fim/fim.go index 7efe000..fb55e7d 100644 --- a/cmd/fim/fim.go +++ b/cmd/fim/fim.go @@ -120,7 +120,11 @@ func Run(args []string) (gdalArgs []string, err error) { } if len(records) < 2 { - return []string{}, fmt.Errorf("no records in control file") + return []string{}, fmt.Errorf("no records in controls file") + } + + if len(records[1]) < 3 { + return []string{}, fmt.Errorf("not enough columns in controls file, need at least 3") } var domainFiles, fimFiles []string diff --git a/scripts/build-darwin-arm64.sh b/scripts/build-darwin-arm64.sh index 22e7724..7bae6e9 100755 --- a/scripts/build-darwin-arm64.sh +++ b/scripts/build-darwin-arm64.sh @@ -7,6 +7,6 @@ echo "Building for Darwin (MacOS) ARM64..." CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -buildvcs=false \ -ldflags="-X main.GitTag=$(git describe --tags --always --dirty) -X main.GitCommit=$(git rev-parse --short HEAD) -X main.BuildDate=$(date +%Y-%m-%d)" \ -o builds/darwin-arm64/flows2fim main.go -echo "Mac build completed." +echo "MacOS ARM64 build completed." chmod +x builds/darwin-arm64/flows2fim diff --git a/scripts/build-linux-amd64.sh b/scripts/build-linux-amd64.sh index e34abde..1a65788 100755 --- a/scripts/build-linux-amd64.sh +++ b/scripts/build-linux-amd64.sh @@ -7,6 +7,6 @@ echo "Building for Linux AMD64..." CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs=false \ -ldflags="-X main.GitTag=$(git describe --tags --always --dirty) -X main.GitCommit=$(git rev-parse --short HEAD) -X main.BuildDate=$(date +%Y-%m-%d)" \ -o builds/linux-amd64/flows2fim main.go -echo "Linux build completed." +echo "Linux AMD64 build completed." chmod +x builds/linux-amd64/flows2fim \ No newline at end of file diff --git a/scripts/build-linux-arm64.sh b/scripts/build-linux-arm64.sh new file mode 100755 index 0000000..00214ec --- /dev/null +++ b/scripts/build-linux-arm64.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# The script must be executed from the root of the repository & within the docker container +set -eo pipefail + +echo "Building for Linux ARM64..." +CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -buildvcs=false \ + -ldflags="-X main.GitTag=$(git describe --tags --always --dirty) -X main.GitCommit=$(git rev-parse --short HEAD) -X main.BuildDate=$(date +%Y-%m-%d)" \ + -o builds/linux-arm64/flows2fim main.go +echo "Linux ARM64 build completed." + +chmod +x builds/linux-arm64/flows2fim diff --git a/scripts/build-windows-amd64.sh b/scripts/build-windows-amd64.sh index ff19f73..f9f1e89 100755 --- a/scripts/build-windows-amd64.sh +++ b/scripts/build-windows-amd64.sh @@ -7,4 +7,4 @@ echo "Building for Windows AMD64..." CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -buildvcs=false \ -ldflags="-X main.GitTag=$(git describe --tags --always --dirty) -X main.GitCommit=$(git rev-parse --short HEAD) -X main.BuildDate=$(date +%Y-%m-%d)" \ -o builds/windows-amd64/flows2fim.exe main.go -echo "Windows build completed." \ No newline at end of file +echo "Windows AMD64 build completed." \ No newline at end of file diff --git a/scripts/create-release-assets.sh b/scripts/create-release-assets.sh index fbe71ab..35b9977 100755 --- a/scripts/create-release-assets.sh +++ b/scripts/create-release-assets.sh @@ -5,10 +5,12 @@ set -eo pipefail ./scripts/build-darwin-arm64.sh ./scripts/build-linux-amd64.sh +./scripts/build-linux-arm64.sh ./scripts/build-windows-amd64.sh echo "Creating release assets ..." zip -j builds/flows2fim-windows-amd64.zip builds/windows-amd64/flows2fim.exe tar -czvf builds/flows2fim-darwin-arm64.tar.gz -C builds/darwin-arm64 flows2fim tar -czvf builds/flows2fim-linux-amd64.tar.gz -C builds/linux-amd64 flows2fim +tar -czvf builds/flows2fim-linux-arm64.tar.gz -C builds/linux-arm64 flows2fim echo "Release assets created" \ No newline at end of file diff --git a/scripts/test_suite_linux.sh b/scripts/test_suite_linux.sh index edda24b..7283ad9 100755 --- a/scripts/test_suite_linux.sh +++ b/scripts/test_suite_linux.sh @@ -498,7 +498,7 @@ fim_test_cases() { -type depth \ -o $fim_test_outputs/fim_test.tif &> "$tempfile" # Assign error string - expected_error_substring="no records in control file" + expected_error_substring="no records in controls file" # Search (grep) for expected error substring in temporary output file if grep -q "$expected_error_substring" "$tempfile"; then printf "\t \u2714 Correct error thrown. \n\n" diff --git a/scripts/test_suite_mac.sh b/scripts/test_suite_mac.sh index 966612d..0187143 100755 --- a/scripts/test_suite_mac.sh +++ b/scripts/test_suite_mac.sh @@ -498,7 +498,7 @@ fim_test_cases() { -type depth \ -o $fim_test_outputs/fim_test.tif &> "$tempfile" # Assign error string - expected_error_substring="no records in control file" + expected_error_substring="no records in controls file" # Search (grep) for expected error substring in temporary output file if grep -q "$expected_error_substring" "$tempfile"; then printf "\t \u2714 Correct error thrown. \n\n"