Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmerice/IceSheet/Greenland/DATA/GET_DATA.sh
3206 views
1
#### GET MINIMAL DATA REQUIRED TO RUN THE GREENLAND APPLICATION
2
function usage {
3
echo "This code will download and process standard data files to run GrIS applications"
4
echo " 1- TOPOGRAPHY: BedMachineGreenland-2017-09-20.nc"
5
echo " 2- OBS. VELOCITY: MEaSUREs Multi-year Greenland Ice Sheet Velocity Mosaic, Version 1"
6
echo " 3- SLIP COEFFICIENT: greenland_elmerice_C1_v0.nc"
7
echo " 4- VISCOSITY: greenland_elmerice_MuMean_v0.nc"
8
echo " 5- SMB : MAR v5.3 "
9
echo
10
echo "requirement: "
11
echo " 1- An account to download data from nsidc (https://nsidc.org/nsidc/register) "
12
echo " 2- curl and wget to download the data files"
13
echo " (optionally you will get the link to download teh files from your webbrowser)"
14
echo " 3- http://www.gdal.org/ to convert from .tif to netcdf and reproject"
15
echo " 4- nco to manipulate netcdf files (http://nco.sourceforge.net/)"
16
echo
17
exit 1
18
}
19
20
21
main() {
22
####################################################################
23
## GET TOPOGRAPHY
24
# IceBridge BedMachine Greenland, Version 3
25
#https://nsidc.org/data/idbmg4#
26
####################################################################
27
TOPOGRAPHY=BedMachineGreenland-2017-09-20.nc
28
if [ ! -f "$TOPOGRAPHY" ]; then
29
echo "****************************************************************"
30
echo " $TOPOGRAPHY file not found downloading from nsidc using curl"
31
echo "****************************************************************"
32
33
sh scripts/GET_FROM_NSIDC.sh https://daacdata.apps.nsidc.org/pub/DATASETS/IDBMG4_BedMachineGr/BedMachineGreenland-2017-09-20.nc
34
fi
35
FILE_IS_HERE $TOPOGRAPHY
36
37
####################################################################
38
## GET VELOCITY DATA
39
#MEaSUREs Multi-year Greenland Ice Sheet Velocity Mosaic, Version 1
40
##http://nsidc.org/data/NSIDC-0670/versions/1#
41
####################################################################
42
VELOCITY_X=greenland_vel_mosaic250_vx_v1.tif
43
if [ ! -f "$VELOCITY_X" ]; then
44
echo "****************************************************************"
45
echo "$VELOCITY_X file not found downloading from nsidc using curl"
46
echo "****************************************************************"
47
sh scripts/GET_FROM_NSIDC.sh https://n5eil01u.ecs.nsidc.org/MEASURES/NSIDC-0670.001/1995.12.01/greenland_vel_mosaic250_vx_v1.tif
48
fi
49
FILE_IS_HERE $VELOCITY_X
50
51
VELOCITY_Y=greenland_vel_mosaic250_vy_v1.tif
52
if [ ! -f "$VELOCITY_Y" ]; then
53
echo "****************************************************************"
54
echo "$VELOCITY_Y file not found downloading from nsidc using curl"
55
echo "****************************************************************"
56
sh scripts/GET_FROM_NSIDC.sh https://n5eil01u.ecs.nsidc.org/MEASURES/NSIDC-0670.001/1995.12.01/greenland_vel_mosaic250_vy_v1.tif
57
fi
58
FILE_IS_HERE $VELOCITY_Y
59
60
#####################################
61
# Convert to netcdf
62
VELOCITY=greenland_vel_mosaic250_v1.nc
63
if [ ! -f "$VELOCITY" ]; then
64
echo "****************************************************************"
65
echo "$VELOCITY not found"
66
echo "****************************************************************"
67
sh scripts/VELOCITY_TO_NETCDF.sh $VELOCITY_X $VELOCITY_Y $VELOCITY
68
fi
69
FILE_IS_HERE $VELOCITY
70
71
72
####################################################################
73
### GET Slip Coefficient from elmerice
74
##
75
####################################################################
76
Slip=greenland_elmerice_C1_v0.nc
77
if [ ! -f "$Slip" ]; then
78
echo "****************************************************************"
79
echo "$Slip not found"
80
echo "****************************************************************"
81
if [ ! -f "greenland_elmerice_C1_v0.nc.tgz" ]; then
82
echo "****************************************************************"
83
echo " Downloading greenland_elmerice_C1_v0.tgz "
84
echo " http://elmerfem.org/elmerice/wiki/lib/exe/fetch.php?media=eis:greenland:present:greenland_elmerice_C1_v0.nc.tgz"
85
echo "****************************************************************"
86
wget http://elmerfem.org/elmerice/wiki/lib/exe/fetch.php?media=eis:greenland:present:greenland_elmerice_C1_v0.nc.tgz -O greenland_elmerice_C1_v0.nc.tgz
87
fi
88
tar xzf greenland_elmerice_C1_v0.nc.tgz
89
fi
90
FILE_IS_HERE $Slip
91
92
####################################################################
93
### GET Viscosity from elmerice
94
##
95
####################################################################
96
Mu=greenland_elmerice_MuMean_v0.nc
97
if [ ! -f "$Mu" ]; then
98
echo "****************************************************************"
99
echo "$Mu not found"
100
echo "****************************************************************"
101
if [ ! -f "greenland_elmerice_mumean_v0.tgz" ]; then
102
echo "****************************************************************"
103
echo " Downloading greenland_elmerice_mumean_v0.tgz "
104
echo " http://elmerfem.org/elmerice/wiki/lib/exe/fetch.php?media=eis:greenland:present:greenland_elmerice_mumean_v0.tgz"
105
echo "****************************************************************"
106
wget http://elmerfem.org/elmerice/wiki/lib/exe/fetch.php?media=eis:greenland:present:greenland_elmerice_mumean_v0.tgz -O greenland_elmerice_mumean_v0.tgz
107
fi
108
tar xzf greenland_elmerice_mumean_v0.tgz
109
fi
110
FILE_IS_HERE $Mu
111
112
####################################################################
113
### GET SMB FORCING
114
## GET SMB 21st century FORCING FROM MAR:
115
## get e.g. MARv3.5-yearly-CanESM2-rcp85-2006-2100.nc
116
####################################################################
117
SMB=MARv3.5-yearly-CanESM2-rcp85-2006-2100.nc
118
link=ftp://ftp.climato.be/fettweis/MARv3.5.2/Greenland/CanESM2-rcp85_2006-2100_25km/monthly_outputs_interpolated_at_5km/MARv3.5-yearly-CanESM2-rcp85-2006-2100.nc
119
SMB_PROJ=MARv3.5-yearly-CanESM2-rcp85-2006-2100_EPSG3413.nc
120
121
if [ ! -f "$SMB_PROJ" ]; then
122
123
if [ ! -f "$SMB" ] ; then
124
echo "****************************************************************"
125
echo " $SMB not found"
126
echo "****************************************************************"
127
echo "downloading data file from $link "
128
wget $link
129
fi
130
FILE_IS_HERE $SMB
131
132
echo
133
echo
134
echo "****************************************************************"
135
echo "Project SMB forcing to EPSG3413:"
136
sh scripts/MAR_Bamber5km_to_EPSG3413.sh $SMB
137
echo
138
echo "****************************************************************"
139
fi
140
FILE_IS_HERE $SMB_PROJ
141
142
143
## GET SMB FORCING FROM MAR:
144
## get e.g. MARv3.5.2-10km-yearly-ERA-Interim-1979-2014.nc
145
if [ ! -f "MARv3.5.2-10km-yearly-ERA-Interim-1979-2014.nc" ] ; then
146
echo "****************************************************************"
147
echo "MARv3.5.2-10km-yearly-ERA-Interim-1979-2014.nc not found"
148
echo "****************************************************************"
149
echo "downloading data file from ftp://ftp.climato.be/fettweis/"
150
wget ftp://ftp.climato.be/fettweis/MARv3.5.2/Greenland/ERA-int_1979-2014_10km/monthly_outputs_interpolated_at_5km/MARv3.5.2-10km-yearly-ERA-Interim-1979-2014.nc
151
echo
152
fi
153
FILE_IS_HERE MARv3.5.2-10km-yearly-ERA-Interim-1979-2014.nc
154
155
if [ ! -f "MARv3.5.2-10km-yearly-ERA-Interim-1979-2014_EPSG3413.nc" ]; then
156
echo
157
echo "****************************************************************"
158
echo "Project SMB forcing to EPSG3413:"
159
sh scripts/MAR_Bamber5km_to_EPSG3413.sh MARv3.5.2-10km-yearly-ERA-Interim-1979-2014.nc
160
echo
161
echo "****************************************************************"
162
fi
163
FILE_IS_HERE MARv3.5.2-10km-yearly-ERA-Interim-1979-2014_EPSG3413.nc
164
165
if [ ! -f "MARv3.5.2-10km-yearly-ERA-Interim-1979-1999_Mean_EPSG3413.nc" ] ; then
166
echo
167
echo "****************************************************************"
168
echo "compute the 1979-1999 mean:"
169
ncra -F -d TIME,1,21,1 MARv3.5.2-10km-yearly-ERA-Interim-1979-2014_EPSG3413.nc MARv3.5.2-10km-yearly-ERA-Interim-1979-1999_Mean_EPSG3413.nc
170
echo "****************************************************************"
171
fi
172
FILE_IS_HERE MARv3.5.2-10km-yearly-ERA-Interim-1979-1999_Mean_EPSG3413.nc
173
174
echo
175
echo
176
echo "SUCCESS! - Now you can run Greenland simulations - enjoy!"
177
echo
178
echo
179
180
}
181
182
##########################
183
##########################
184
function FILE_IS_HERE {
185
if [ ! -f "$1" ]; then
186
echo
187
echo "File $1 still not found. Aborting !!"
188
echo " see http://elmerice.elmerfem.org/wiki/doku.php?id=eis:greenland#present"
189
echo " for details on how to get the dataset"
190
echo
191
exit
192
else
193
echo "File $1 is present"
194
fi
195
}
196
197
##########################
198
##########################
199
if [ ! $# -eq 0 ]
200
then
201
usage
202
fi
203
204
205
206
main
207
208
209