annotate c3s.sh @ 1:eadc0e7f9abd draft default tip

planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit e8074c9f6817bba5ca6cb322434ca5e4412b34cf
author climate
date Fri, 27 Sep 2024 19:34:28 +0000
parents 7fa6bc1fb588
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
1 #!/usr/bin/env bash
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
2
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
3 if [ -f download.tar.gz ]; then
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
4 tar zxvf download.tar.gz
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
5 cat *.grib > tmp.grib
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
6 cdo setgridtype,regular tmp.grib tmpg.grib
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
7 cdo -f nc -t ecmwf copy tmpg.grib tmp.nc
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
8 elif [ -f download.zip ]; then
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
9 unzip download.zip
1
eadc0e7f9abd planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit e8074c9f6817bba5ca6cb322434ca5e4412b34cf
climate
parents: 0
diff changeset
10 files=(*.nc)
eadc0e7f9abd planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit e8074c9f6817bba5ca6cb322434ca5e4412b34cf
climate
parents: 0
diff changeset
11 if [ -e "${files[0]}" ]; then
eadc0e7f9abd planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit e8074c9f6817bba5ca6cb322434ca5e4412b34cf
climate
parents: 0
diff changeset
12 mv ${files[0]} tmp.nc
eadc0e7f9abd planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit e8074c9f6817bba5ca6cb322434ca5e4412b34cf
climate
parents: 0
diff changeset
13 else
eadc0e7f9abd planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit e8074c9f6817bba5ca6cb322434ca5e4412b34cf
climate
parents: 0
diff changeset
14 cat *.grib > tmp.grib
eadc0e7f9abd planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit e8074c9f6817bba5ca6cb322434ca5e4412b34cf
climate
parents: 0
diff changeset
15 cdo setgridtype,regular tmp.grib tmpg.grib
eadc0e7f9abd planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit e8074c9f6817bba5ca6cb322434ca5e4412b34cf
climate
parents: 0
diff changeset
16 cdo -f nc -t ecmwf copy tmpg.grib tmp.nc
eadc0e7f9abd planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit e8074c9f6817bba5ca6cb322434ca5e4412b34cf
climate
parents: 0
diff changeset
17 fi
0
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
18 elif [ -f download.grib ]; then
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
19 cdo -f nc -t ecmwf copy download.grib tmp.nc
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
20 elif [ -f download.nc ]; then
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
21 mv download.nc tmp.nc
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
22 else
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
23 echo "No data found! Check your request and/or credentials."
7fa6bc1fb588 "planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/c3s commit 04069ef63198279caf3d97de5a58fb32df12c811"
climate
parents:
diff changeset
24 fi