Path: blob/devel/elmerice/IceSheet/Greenland/DATA/GET_DATA.sh
3206 views
#### GET MINIMAL DATA REQUIRED TO RUN THE GREENLAND APPLICATION1function usage {2echo "This code will download and process standard data files to run GrIS applications"3echo " 1- TOPOGRAPHY: BedMachineGreenland-2017-09-20.nc"4echo " 2- OBS. VELOCITY: MEaSUREs Multi-year Greenland Ice Sheet Velocity Mosaic, Version 1"5echo " 3- SLIP COEFFICIENT: greenland_elmerice_C1_v0.nc"6echo " 4- VISCOSITY: greenland_elmerice_MuMean_v0.nc"7echo " 5- SMB : MAR v5.3 "8echo9echo "requirement: "10echo " 1- An account to download data from nsidc (https://nsidc.org/nsidc/register) "11echo " 2- curl and wget to download the data files"12echo " (optionally you will get the link to download teh files from your webbrowser)"13echo " 3- http://www.gdal.org/ to convert from .tif to netcdf and reproject"14echo " 4- nco to manipulate netcdf files (http://nco.sourceforge.net/)"15echo16exit 117}181920main() {21####################################################################22## GET TOPOGRAPHY23# IceBridge BedMachine Greenland, Version 324#https://nsidc.org/data/idbmg4#25####################################################################26TOPOGRAPHY=BedMachineGreenland-2017-09-20.nc27if [ ! -f "$TOPOGRAPHY" ]; then28echo "****************************************************************"29echo " $TOPOGRAPHY file not found downloading from nsidc using curl"30echo "****************************************************************"3132sh scripts/GET_FROM_NSIDC.sh https://daacdata.apps.nsidc.org/pub/DATASETS/IDBMG4_BedMachineGr/BedMachineGreenland-2017-09-20.nc33fi34FILE_IS_HERE $TOPOGRAPHY3536####################################################################37## GET VELOCITY DATA38#MEaSUREs Multi-year Greenland Ice Sheet Velocity Mosaic, Version 139##http://nsidc.org/data/NSIDC-0670/versions/1#40####################################################################41VELOCITY_X=greenland_vel_mosaic250_vx_v1.tif42if [ ! -f "$VELOCITY_X" ]; then43echo "****************************************************************"44echo "$VELOCITY_X file not found downloading from nsidc using curl"45echo "****************************************************************"46sh scripts/GET_FROM_NSIDC.sh https://n5eil01u.ecs.nsidc.org/MEASURES/NSIDC-0670.001/1995.12.01/greenland_vel_mosaic250_vx_v1.tif47fi48FILE_IS_HERE $VELOCITY_X4950VELOCITY_Y=greenland_vel_mosaic250_vy_v1.tif51if [ ! -f "$VELOCITY_Y" ]; then52echo "****************************************************************"53echo "$VELOCITY_Y file not found downloading from nsidc using curl"54echo "****************************************************************"55sh scripts/GET_FROM_NSIDC.sh https://n5eil01u.ecs.nsidc.org/MEASURES/NSIDC-0670.001/1995.12.01/greenland_vel_mosaic250_vy_v1.tif56fi57FILE_IS_HERE $VELOCITY_Y5859#####################################60# Convert to netcdf61VELOCITY=greenland_vel_mosaic250_v1.nc62if [ ! -f "$VELOCITY" ]; then63echo "****************************************************************"64echo "$VELOCITY not found"65echo "****************************************************************"66sh scripts/VELOCITY_TO_NETCDF.sh $VELOCITY_X $VELOCITY_Y $VELOCITY67fi68FILE_IS_HERE $VELOCITY697071####################################################################72### GET Slip Coefficient from elmerice73##74####################################################################75Slip=greenland_elmerice_C1_v0.nc76if [ ! -f "$Slip" ]; then77echo "****************************************************************"78echo "$Slip not found"79echo "****************************************************************"80if [ ! -f "greenland_elmerice_C1_v0.nc.tgz" ]; then81echo "****************************************************************"82echo " Downloading greenland_elmerice_C1_v0.tgz "83echo " http://elmerfem.org/elmerice/wiki/lib/exe/fetch.php?media=eis:greenland:present:greenland_elmerice_C1_v0.nc.tgz"84echo "****************************************************************"85wget 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.tgz86fi87tar xzf greenland_elmerice_C1_v0.nc.tgz88fi89FILE_IS_HERE $Slip9091####################################################################92### GET Viscosity from elmerice93##94####################################################################95Mu=greenland_elmerice_MuMean_v0.nc96if [ ! -f "$Mu" ]; then97echo "****************************************************************"98echo "$Mu not found"99echo "****************************************************************"100if [ ! -f "greenland_elmerice_mumean_v0.tgz" ]; then101echo "****************************************************************"102echo " Downloading greenland_elmerice_mumean_v0.tgz "103echo " http://elmerfem.org/elmerice/wiki/lib/exe/fetch.php?media=eis:greenland:present:greenland_elmerice_mumean_v0.tgz"104echo "****************************************************************"105wget http://elmerfem.org/elmerice/wiki/lib/exe/fetch.php?media=eis:greenland:present:greenland_elmerice_mumean_v0.tgz -O greenland_elmerice_mumean_v0.tgz106fi107tar xzf greenland_elmerice_mumean_v0.tgz108fi109FILE_IS_HERE $Mu110111####################################################################112### GET SMB FORCING113## GET SMB 21st century FORCING FROM MAR:114## get e.g. MARv3.5-yearly-CanESM2-rcp85-2006-2100.nc115####################################################################116SMB=MARv3.5-yearly-CanESM2-rcp85-2006-2100.nc117link=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.nc118SMB_PROJ=MARv3.5-yearly-CanESM2-rcp85-2006-2100_EPSG3413.nc119120if [ ! -f "$SMB_PROJ" ]; then121122if [ ! -f "$SMB" ] ; then123echo "****************************************************************"124echo " $SMB not found"125echo "****************************************************************"126echo "downloading data file from $link "127wget $link128fi129FILE_IS_HERE $SMB130131echo132echo133echo "****************************************************************"134echo "Project SMB forcing to EPSG3413:"135sh scripts/MAR_Bamber5km_to_EPSG3413.sh $SMB136echo137echo "****************************************************************"138fi139FILE_IS_HERE $SMB_PROJ140141142## GET SMB FORCING FROM MAR:143## get e.g. MARv3.5.2-10km-yearly-ERA-Interim-1979-2014.nc144if [ ! -f "MARv3.5.2-10km-yearly-ERA-Interim-1979-2014.nc" ] ; then145echo "****************************************************************"146echo "MARv3.5.2-10km-yearly-ERA-Interim-1979-2014.nc not found"147echo "****************************************************************"148echo "downloading data file from ftp://ftp.climato.be/fettweis/"149wget 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.nc150echo151fi152FILE_IS_HERE MARv3.5.2-10km-yearly-ERA-Interim-1979-2014.nc153154if [ ! -f "MARv3.5.2-10km-yearly-ERA-Interim-1979-2014_EPSG3413.nc" ]; then155echo156echo "****************************************************************"157echo "Project SMB forcing to EPSG3413:"158sh scripts/MAR_Bamber5km_to_EPSG3413.sh MARv3.5.2-10km-yearly-ERA-Interim-1979-2014.nc159echo160echo "****************************************************************"161fi162FILE_IS_HERE MARv3.5.2-10km-yearly-ERA-Interim-1979-2014_EPSG3413.nc163164if [ ! -f "MARv3.5.2-10km-yearly-ERA-Interim-1979-1999_Mean_EPSG3413.nc" ] ; then165echo166echo "****************************************************************"167echo "compute the 1979-1999 mean:"168ncra -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.nc169echo "****************************************************************"170fi171FILE_IS_HERE MARv3.5.2-10km-yearly-ERA-Interim-1979-1999_Mean_EPSG3413.nc172173echo174echo175echo "SUCCESS! - Now you can run Greenland simulations - enjoy!"176echo177echo178179}180181##########################182##########################183function FILE_IS_HERE {184if [ ! -f "$1" ]; then185echo186echo "File $1 still not found. Aborting !!"187echo " see http://elmerice.elmerfem.org/wiki/doku.php?id=eis:greenland#present"188echo " for details on how to get the dataset"189echo190exit191else192echo "File $1 is present"193fi194}195196##########################197##########################198if [ ! $# -eq 0 ]199then200usage201fi202203204205main206207208209