⚲
Project
General
Profile
Sign in
Register
Home
Projects
Imprint + Privacy Policy
Help
Search
:
CDO
All Projects
CDO
Overview
Activity
News
Wiki
Forums
Files
Documentation
Download (726 Bytes)
RE: cdo outputtab
ยป values2.sh
Muhammad Ramzan
, 2023-05-03 15:31
#!/bin/bash
for
NUM
in
$(
seq
2011 2014
)
do
infile
=
"air.
$NUM
.nc"
coords
=
"coords.txt"
while
read
line
do
line
=
$(
echo
$line
|
sed
-e
's/\r//g'
)
station
=
$(
echo
$line
|
cut
-d
' '
-f
1
)
#-- skip header line
if
[[
"
$station
"
==
"station"
]]
;
then continue
;
fi
#-- select station coordinates
lat
=
$(
echo
$line
|
cut
-d
' '
-f
2
)
lon
=
$(
echo
$line
|
cut
-d
' '
-f
3
)
station
=
"
${
NUM
}
_
${
station
}
_
${
lat
}
_
${
lon
}
"
#-- extract the station data
cdo
-remapnn
,
"lon=
${
lon
}
_lat=
${
lat
}
"
${
infile
}
${
station
}
_out.nc
cdo
-s
-outputtab
,date,time,year,month,day,x,y,lon,lat,lev,name,value
\
${
station
}
_out.nc |
\
awk
'NR>1 {$8="'
${
lon
}
'"; $9="'
${
lat
}
'"}1'
>
${
station
}
_out.txt
done
<
$coords
done
(1-1/1)
Loading...