IS-ENES/core2_cmip: script_extract.sh

File script_extract.sh, 1.4 KB (added by flavoni, 10 years ago)
Line 
1#!/bin/sh -u
2# script used for Inter Annual forcing core2
3# extract every year from downloaded file of form: 1948-2007.nc
4
5year=1948
6
7ncatted -a calendar,TIME,m,c,365_day ok_download/ncar_precip.1948-2007.04MAR2010.nc ncar_precip.1948-2007.365.nc
8ncatted -a calendar,TIME,m,c,365_day ok_download/ncar_rad.1948-2007.04MAR2010.nc ncar_rad.1948-2007.365.nc
9ncatted -a calendar,TIME,m,c,365_day ok_download/u_10.1948-2007.04MAR2010.nc u_10.1948-2007.365.nc
10ncatted -a calendar,TIME,m,c,365_day ok_download/v_10.1948-2007.04MAR2010.nc v_10.1948-2007.365.nc
11ncatted -a calendar,TIME,m,c,365_day ok_download/t_10.1948-2007.04MAR2010.nc t_10.1948-2007.365.nc
12ncatted -a calendar,TIME,m,c,365_day ok_download/q_10.1948-2007.04MAR2010.nc q_10.1948-2007.365.nc
13for (( year=1948; year<=2007; year++ )) ; do
14       cdo selyear,$year ncar_precip.1948-2007.365.nc ncar_precip.$year.nc
15       echo "finished ncar_precip $year"
16       cdo selyear,$year ncar_rad.1948-2007.365.nc    ncar_rad.$year.nc
17       echo "finished ncar_rad $year"
18       cdo selyear,$year q_10.1948-2007.365.nc q_10.$year.nc
19       echo "finished q_10 $year"
20       cdo selyear,$year t_10.1948-2007.365.nc t_10.$year.nc
21       echo "finished t_10 $year"
22       cdo selyear,$year u_10.1948-2007.365.nc u_10.$year.nc
23       echo "finished u_10 $year"
24       cdo selyear,$year v_10.1948-2007.365.nc v_10.$year.nc
25       echo "finished v_10 $year"
26 done
27
28echo "exit fine dello script"
29exit 0