homebrew-core/Formula/cdo.rb

52 lines
2.4 KiB
Ruby

class Cdo < Formula
desc "Climate Data Operators"
homepage "https://code.mpimet.mpg.de/projects/cdo"
url "https://code.mpimet.mpg.de/attachments/download/26761/cdo-2.0.4.tar.gz"
sha256 "73c0c1e5348632e6e8452ea8e617c35499bc55c845ee2c1d42b912a7e00e5533"
license "GPL-2.0-only"
revision 1
livecheck do
url "https://code.mpimet.mpg.de/projects/cdo/files"
regex(/href=.*?cdo[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_monterey: "dcae67b819248e2dfb252eca9fd9049ec88de49df052c2cf8b3264c7c8f7af04"
sha256 cellar: :any, arm64_big_sur: "beb4db6be5e800514601d0fe72f9a0c3a147bfdbec1c918713450538b4726713"
sha256 cellar: :any, monterey: "21015b4db5fd00a89569fd7bbc777c5ee0b0fa47921bf852426018c0b6108342"
sha256 cellar: :any, big_sur: "d06efa9a8c38c92edda51e0f6cb94d8894a07784c3f5962f679fcf3a3b3847ee"
sha256 cellar: :any, catalina: "7c0e6e0dabca51c4797edf5dcf907fe9e27e53563ad933baccd939d74119ea5b"
sha256 cellar: :any_skip_relocation, x86_64_linux: "29779f499ad2a3a2006ff334533c715ffce232949f80d3163c87be5f276168b0"
end
depends_on "eccodes"
depends_on "hdf5"
depends_on "netcdf"
depends_on "proj"
depends_on "szip"
def install
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
--with-eccodes=#{Formula["eccodes"].opt_prefix}
--with-netcdf=#{Formula["netcdf"].opt_prefix}
--with-hdf5=#{Formula["hdf5"].opt_prefix}
--with-szlib=#{Formula["szip"].opt_prefix}
]
system "./configure", *args
system "make", "install"
end
test do
data = <<~EOF.unpack1("m")
R1JJQgABvAEAABz/AAD/gAEBAABkAAAAAAEAAAoAAAAAAAAAAAAgAP8AABIACgB+9IBrbIABLrwA4JwTiBOIQAAAAAAAAXQIgAPEFI2rEBm9AACVLSuNtwvRALldqDul2GV1pw1CbXsdub2q9a/17Yi9o11DE0UFWwRjqsvH80wgS82o3UJ9rkitLcPgxJDVaO9No4XV6EWNPeUSSC7txHi7/aglVaO5uKKtwr2slV5DYejEoKOwpdirLXPIGUAWCya7ntil1amLu4PCtafNp5OpPafFqVWmxaQto72sMzGQJeUxcJkbqEWnOKM9pTOlTafdqPCoc6tAq0WqFarTq2i5M1NdRq2AHWzFpFWj1aJtmAOrhaJzox2nwKr4qQWofaggqz2rkHcog2htuI2YmOB9hZDIpxXA3ahdpzOnDarjqj2k0KlIqM2oyJsjjpODmGu1YtU6WHmNZ5uljcbVrduuOK1DrDWjGKM4pQCmfdVFprWbnVd7Vw1QY1s9VnNzvZiLmGucPZwVnM2bm5yFqb2cHdRQqs2hhZrrm1VGeEQgOduhjbWrqAWfzaANnZOdWJ0NnMWeJQA3Nzc3AAAAAA==
EOF
File.binwrite("test.grb", data)
system "#{bin}/cdo", "-f", "nc", "copy", "test.grb", "test.nc"
assert_predicate testpath/"test.nc", :exist?
end
end