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 (2362B)
       ---
            1 #!/bin/bash
            2 
            3 # Copyright (C) 2009-2014, 2016 Ed Bueler and Andy Aschwanden
            4 
            5 # downloads SeaRISE "Present Day Greenland" master dataset NetCDF file, adjusts metadata,
            6 # saves under new name, ready for PISM
            7 
            8 # depends on wget and NCO (ncrename, ncap, ncatted, ncpdq, ncks)
            9 
           10 set -e  # exit on error
           11 
           12 echo "# =================================================================================="
           13 echo "# preprocessing SeaRISE-Greenland data for relaxation experiment"
           14 echo "# =================================================================================="
           15 echo
           16 
           17 # get file; see page http://websrv.cs.umt.edu/isis/index.php/Present_Day_Greenland
           18 DATAVERSION=1.1
           19 DATAURL=http://websrv.cs.umt.edu/isis/images/a/a5/
           20 DATANAME=Greenland_5km_v$DATAVERSION.nc
           21 
           22 echo "fetching master file ... "
           23 wget -nc ${DATAURL}${DATANAME}
           24 echo "  ... done."
           25 echo
           26 
           27 PISMVERSION=pism_$DATANAME
           28 echo -n "creating bootstrapable $PISMVERSION from $DATANAME ..."
           29 ncks -O $DATANAME $PISMVERSION  # just copies over, but preserves history and global attrs
           30 
           31 # adjust metadata; uses NCO (http://nco.sourceforge.net/)
           32 # convert from water equivalent rate to "kg m-2 year-1"; assumes water density 1000.0 kg m-3
           33 ncap2 -O -s "precipitation=presprcp*1000.0" $PISMVERSION $PISMVERSION
           34 ncatted -O -a units,airtemp2m,c,c,"degC" $PISMVERSION
           35 ncatted -O -a units,precipitation,m,c,"kg m-2 year-1" $PISMVERSION
           36 ncatted -O -a long_name,precipitation,c,c,"ice-equivalent mean annual precipitation rate" $PISMVERSION
           37 # delete incorrect standard_name attribute from bheatflx; there is no known standard_name
           38 ncatted -a standard_name,bheatflx,d,, $PISMVERSION
           39 ncrename -O -v smb,climatic_mass_balance -v airtemp2m,ice_surface_temp $PISMVERSION $PISMVERSION
           40 ncks -O -v lat,lon,bheatflx,topg,thk,precipitation,mapping,climatic_mass_balance,ice_surface_temp  $PISMVERSION $PISMVERSION
           41 # convert from [m/year] ice equivalent to [kg m-2 year-1]; assumes ice density of 910.0 [kg m-3]
           42 ncap2 -O -s "climatic_mass_balance=climatic_mass_balance*910.0" $PISMVERSION $PISMVERSION
           43 ncatted -O -a units,climatic_mass_balance,m,c,"kg m-2 year-1" $PISMVERSION
           44 echo "done."
           45 echo
           46 
           47 echo "create target ice thickness file"
           48 ncap2 -O -s "thk=thk*0.; climatic_mass_balance[\$time,\$y1,\$x1]=-500.f*910.0" $PISMVERSION target_$PISMVERSION
           49 ncatted -a units,climatic_mass_balance,o,c,"kg m-2 year-1" target_$PISMVERSION
           50 echo "done."
           51 echo
           52