<s> import os <EOL> import numpy as np <EOL> import flopy <EOL> import flopy . pest . templatewriter as tplwriter <EOL> import flopy . pest . params as params <EOL> def test_tpl_constant ( ) : <EOL> nlay = <NUM_LIT:3> <EOL> nrow = <NUM_LIT:20> <EOL> ncol = <NUM_LIT:20> <EOL> m = flopy . modflow . Modflow ( modelname = '<STR_LIT>' , model_ws = '<STR_LIT>' ) <EOL> dis = flopy . modflow . ModflowDis ( m , nlay , nrow , ncol ) <EOL> lpf = flopy . modflow . ModflowLpf ( m , hk = <NUM_LIT> ) <EOL> mfpackage = '<STR_LIT>' <EOL> partype = '<STR_LIT>' <EOL> parname = '<STR_LIT>' <EOL> idx = np . empty ( ( nlay , nrow , ncol ) , dtype = np . bool ) <EOL> idx [ <NUM_LIT:0> ] = True <EOL> idx [ <NUM_LIT:1> : ] = False <EOL> span = { '<STR_LIT>' : idx } <EOL> startvalue = <NUM_LIT> <EOL> lbound = <NUM_LIT> <EOL> ubound = <NUM_LIT> <EOL> transform = '<STR_LIT>' <EOL> p = params . Params ( mfpackage , partype , parname , startvalue , <EOL> lbound , ubound , span ) <EOL> tw = tplwriter . TemplateWriter ( m , [ p ] ) <EOL> tw . write_template ( ) <EOL> tplfile = os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert os . path . isfile ( tplfile ) <EOL> return <EOL> def test_tpl_layered ( ) : <EOL> nlay = <NUM_LIT:3> <EOL> nrow = <NUM_LIT:20> <EOL> ncol = <NUM_LIT:20> <EOL> m = flopy . modflow . Modflow ( modelname = '<STR_LIT>' , model_ws = '<STR_LIT>' ) <EOL> dis = flopy . modflow . ModflowDis ( m , nlay , nrow , ncol ) <EOL> lpf = flopy . modflow . ModflowLpf ( m , hk = <NUM_LIT> ) <EOL> mfpackage = '<STR_LIT>' <EOL> partype = '<STR_LIT>' <EOL> parname = '<STR_LIT>' <EOL> span = { '<STR_LIT>' : [ <NUM_LIT:0> , <NUM_LIT:2> ] } <EOL> startvalue = <NUM_LIT> <EOL> lbound = <NUM_LIT> <EOL> ubound = <NUM_LIT> <EOL> transform = '<STR_LIT>' <EOL> p = params . Params ( mfpackage , partype , parname , startvalue , <EOL> lbound , ubound , span ) <EOL> tw = tplwriter . TemplateWriter ( m , [ p ] ) <EOL> tw . write_template ( ) <EOL> tplfile = os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert os . path . isfile ( tplfile ) <EOL> return <EOL> def test_tpl_zoned ( ) : <EOL> nlay = <NUM_LIT:3> <EOL> nrow = <NUM_LIT:20> <EOL> ncol = <NUM_LIT:20> <EOL> m = flopy . modflow . Modflow ( modelname = '<STR_LIT>' , model_ws = '<STR_LIT>' ) <EOL> dis = flopy . modflow . ModflowDis ( m , nlay , nrow , ncol ) <EOL> lpf = flopy . modflow . ModflowLpf ( m , hk = <NUM_LIT> ) <EOL> zonearray = np . ones ( ( nlay , nrow , ncol ) , dtype = int ) <EOL> zonearray [ <NUM_LIT:0> , <NUM_LIT:10> : , <NUM_LIT:7> : ] = <NUM_LIT:2> <EOL> zonearray [ <NUM_LIT:0> , <NUM_LIT:15> : , <NUM_LIT:9> : ] = <NUM_LIT:3> <EOL> zonearray [ <NUM_LIT:1> ] = <NUM_LIT:4> <EOL> mfpackage = '<STR_LIT>' <EOL> parzones = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] <EOL> parvals = [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] <EOL> lbound = <NUM_LIT:5> <EOL> ubound = <NUM_LIT> <EOL> transform = '<STR_LIT>' <EOL> plisthk = params . zonearray2params ( mfpackage , '<STR_LIT>' , parzones , lbound , <EOL> ubound , parvals , transform , zonearray ) <EOL> parzones = [ <NUM_LIT:1> , <NUM_LIT:2> ] <EOL> parvals = [ <NUM_LIT> , <NUM_LIT> ] <EOL> zonearray = np . ones ( ( nlay , nrow , ncol ) , dtype = int ) <EOL> zonearray [ <NUM_LIT:1> ] = <NUM_LIT:2> <EOL> plistvk = params . zonearray2params ( mfpackage , '<STR_LIT>' , parzones , lbound , <EOL> ubound , parvals , transform , zonearray ) <EOL> plist = plisthk + plistvk <EOL> tw = tplwriter . TemplateWriter ( m , plist ) <EOL> tw . write_template ( ) <EOL> tplfile = os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert os . path . isfile ( tplfile ) <EOL> return <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test_tpl_constant ( ) <EOL> test_tpl_layered ( ) <EOL> test_tpl_zoned ( ) </s>
