tpreprocess.sh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch) (HTM) git clone git://src.adamsgaard.dk/pism (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- tpreprocess.sh (2677B) --- 1 #!/bin/bash 2 3 # Copyright (C) 2009-2018, 2020 PISM authors 4 5 # downloads development version of SeaRISE "Present Day Antarctica" master 6 # dataset NetCDF file, adjusts metadata, breaks up, saves under new names, 7 # ready for PISM 8 9 # depends on wget and NCO (ncrename, ncap2, ncatted, ncpdq, ncks) 10 11 set -e # exit on error 12 13 # get file; see page http://websrv.cs.umt.edu/isis/index.php/Present_Day_Antarctica 14 DATAVERSION=dev1.0 15 DATANAME=Antarctica_5km_$DATAVERSION.nc 16 echo 17 echo "downloading master $DATANAME ..." 18 wget -nc http://websrv.cs.umt.edu/isis/images/4/4d/$DATANAME 19 20 echo "making PISM-readable file by copying parts of $DATANAME" 21 echo " and adjusting metadata ..." 22 PISMVERSION=pism_Antarctica_5km.nc 23 cp $DATANAME $PISMVERSION 24 25 # following use NCO (http://nco.sourceforge.net/) 26 # rename dimensions 27 ncrename -O -v x1,x -v y1,y -d x1,x -d y1,y $PISMVERSION 28 ncrename -O -v time,t -d time,t $PISMVERSION 29 # fix polar stereographic parameter 30 ncatted -O -a standard_parallel,mapping,m,d,-71.0 $PISMVERSION 31 # rename usurf for convenience 32 ncrename -O -v usrf,usurf $PISMVERSION 33 # fix surface temperature name and make K 34 ncap2 -O -s "air_temp=temp+273.15" $PISMVERSION $PISMVERSION 35 ncatted -O -a units,air_temp,m,c,"K" $PISMVERSION 36 # choose Van de Berg et al version of accumulation; will treat as 37 # ice-equivalent snow rate and convert from an ice-equivalent 38 # thickness rate ("m year-1") to "kg m-2 year-1" by assuming ice 39 # density of 910 kg m-3 40 ncap2 -O -s "precipitation=accr*910.0" $PISMVERSION $PISMVERSION 41 ncatted -O -a units,precipitation,m,c,"kg m-2 year-1" $PISMVERSION 42 # use bheatflx_shapiro as the default bheatflx data 43 ncrename -O -v bheatflx_shapiro,bheatflx $PISMVERSION 44 ncatted -O -a units,bheatflx,m,c,"W m-2" $PISMVERSION 45 # delete incorrect standard_name attribute from bheatflx; there is no known standard_name 46 ncatted -O -a standard_name,bheatflx,d,, $PISMVERSION 47 # keep only the fields we actually use at bootstrapping 48 ncks -O -v x,y,lat,lon,bheatflx,topg,thk,precipitation,air_temp,mapping \ 49 $PISMVERSION $PISMVERSION 50 # remove the time dimension 51 ncwa -O -a t $PISMVERSION $PISMVERSION 52 # remove the time (t) coordinate variable 53 ncks -O -x -v t $PISMVERSION $PISMVERSION 54 # generate the maximum extent mask 55 ncap2 -A \ 56 -s 'land_ice_area_fraction_retreat=0 * thk' \ 57 -s 'where(thk > 0 || topg > 0) land_ice_area_fraction_retreat=1' \ 58 -s 'land_ice_area_fraction_retreat@units="1"' \ 59 $PISMVERSION $PISMVERSION 60 ncatted -a standard_name,land_ice_area_fraction_retreat,d,, $PISMVERSION 61 62 echo " PISM-readable file $PISMVERSION created; only has fields" 63 echo " used in bootstrapping." 64 65 echo "now run spin-up script 'antspin-coarse.sh'" 66 echo