Source code for pycif.plugins.domains.chimere.utils.make_domainlist
import os
import shutil
[docs]
def make_domainlist(domain):
domainlist_ref = f"{domain.repgrid}/domainlist.nml"
domainlist_target = f"{domain.workdir}/domain/domainlist.nml"
if os.path.isfile(domainlist_target):
shutil.rmtree(domainlist_target)
if os.path.isfile(domainlist_ref):
shutil.copy(domainlist_ref, domainlist_target)
else:
with open(domainlist_target, "w") as fgrid:
fgrid.write(
"domain NX NY DX DY XMIN YMIN "
" REG PATH DEC POLAR\n")
with open(domainlist_target, "a") as fgrid:
fgrid.write(f"{domain.domid} {domain.nlon} {domain.nlat} {domain.dx} {domain.dy} {domain.xmin if domain.type == 'deg' else domain.xcenter} {domain.ymin if domain.type == 'deg' else domain.ycenter} {domain.type} na {-99} {0}\n")