-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetwind.scr
48 lines (37 loc) · 1.72 KB
/
getwind.scr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
#QSUB -eo -q sb -lT 1200 -s /bin/csh
#Run on an HP-UX machine or norway to access ncks
# lat and lon are in decimal degrees
# These must be identical between this script and run_regrid_wind.scr
set MIN_LAT = 31
set MAX_LAT = 40
set MIN_LON = -90
set MAX_LON = -75
#set OUTDIR = /nfs/logic/home/edm/glakes/metdata/NCAR-wind/raw_wind/
set OUTDIR = ./cmd/raw_wind/
set STARTYR = 1998
set ENDYR = 2007
#First option is for HP-UX, second is when logged into norway
#set NCKS = /nfs/norway/home/nijssen/hpux/bin/ncks
#set NCKS = /usr/local/bin/ncks
set NCKS = /usr/bin/ncks
#set NCKS = /usr/local/bin/ncks
#set NCKS = /home/billah/nco/bin/ncks
#######################################################################
set YEAR = $STARTYR
while ( $YEAR <= $ENDYR )
set LONMN = `echo $MIN_LON '+' 360.0 | bc -l`
set LONMX = `echo $MAX_LON '+' 360.0 | bc -l`
set LAT1 = `awk '{if($1<'$MAX_LAT') {print NR-1;exit}}' ./cmd/gauss_t62_lat.list`
set LAT2 = `awk '{if($1<'$MIN_LAT') {print NR;exit}}' ./cmd/gauss_t62_lat.list`
set LON1 = `awk '{if($1>'$LONMN') {print NR-1;exit}}' ./cmd/gauss_t62_lon.list`
set LON2 = `awk '{if($1>'$LONMX') {print NR;exit}}' ./cmd/gauss_t62_lon.list`
#putting the -R flag after ncks retains the raw netCDF data files
echo $YEAR
$NCKS -p ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis.dailyavgs/surface_gauss/ -H -C -v uwnd -s "%d\n" -d lat,$LAT1,$LAT2 -d lon,$LON1,$LON2 -l $OUTDIR uwnd.10m.gauss.$YEAR.nc > $OUTDIR/uwnd.$YEAR.asc
$NCKS -p ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis.dailyavgs/surface_gauss/ -H -C -v vwnd -s "%d\n" -d lat,$LAT1,$LAT2 -d lon,$LON1,$LON2 -l $OUTDIR vwnd.10m.gauss.$YEAR.nc > $OUTDIR/vwnd.$YEAR.asc
/bin/rm -f uwnd.10m.gauss.$YEAR.nc
/bin/rm -f vwnd.10m.gauss.$YEAR.nc
@ YEAR ++
end
exit 0