pism-exp-gsw

ice stream and sediment transport experiments
git clone git://src.adamsgaard.dk/pism-exp-gsw # fast
git clone https://src.adamsgaard.dk/pism-exp-gsw.git # slow
Log | Files | Refs | README | LICENSE Back to index

flowlineslab.py (1364B)


      1 #!/usr/bin/env python3
      2 
      3 # creates an example flowline data set "slab.nc" which can be used with
      4 # flowline.py to show how to run PISM in flow-line mode
      5 
      6 # see the "Using PISM for flow-line modeling" subsection of the Users Manual
      7 
      8 # We recommend creating more metadata-rich datasets than is done here.
      9 # Here we generate the bare minimum to work with flowline.py and PISM.
     10 
     11 from numpy import linspace, minimum, maximum, abs
     12 import netCDF4
     13 
     14 Lx = 1000e3                     # 1000 km
     15 Mx = 501
     16 topg_slope = -1e-4
     17 thk_0 = 1e3                        # meters
     18 climatic_mass_balance_0 = 0             # kg m-2 s-1
     19 ice_surface_temp_0 = -10           # Celsius
     20 
     21 nc = netCDF4.Dataset("slab.nc", 'w')
     22 nc.createDimension('x', Mx)
     23 
     24 x = nc.createVariable('x',    'f4', ('x',))
     25 topg = nc.createVariable('topg', 'f4', ('x',))
     26 thk = nc.createVariable('thk',  'f4', ('x',))
     27 climatic_mass_balance = nc.createVariable('climatic_mass_balance', 'f4', ('x',))
     28 ice_surface_temp = nc.createVariable('ice_surface_temp', 'f4', ('x',))
     29 
     30 x[:] = linspace(-Lx, Lx, Mx)
     31 x.units = "m"
     32 topg[:] = topg_slope * (x[:] - Lx)
     33 topg.units = "m"
     34 
     35 thk[:] = maximum(minimum(5e3 - abs(x[:]) * 0.01, thk_0), 0)
     36 thk.units = "m"
     37 
     38 climatic_mass_balance[:] = climatic_mass_balance_0
     39 climatic_mass_balance.units = "kg m-2 s-1"
     40 ice_surface_temp[:] = ice_surface_temp_0
     41 ice_surface_temp.units = "Celsius"
     42 
     43 nc.close()