Exemple #1
0
def write_gdir_doc():
    """This is to write the docs for glacierdir automatically."""

    here = os.path.dirname(__file__)
    origfile = os.path.join(here, '_templates', 'basenames.txt')
    filename = os.path.join(here, '_generated', 'basenames.txt')

    try:
        os.makedirs(os.path.dirname(filename))
    except FileExistsError:
        pass

    shutil.copyfile(origfile, filename)

    from oggm.cfg import BASENAMES

    cnt = ['    ']
    for k in sorted(BASENAMES.keys()):
        cnt += [BASENAMES.info_str(k)] + ['    ']
    cnt = '\n'.join(cnt)

    file = open(filename, 'a')
    try:
        file.write(cnt)
    finally:
        file.close()
Exemple #2
0
def write_gdir_doc():
    """This is to write the docs for glacierdir automatically."""

    here = os.path.dirname(__file__)
    origfile = os.path.join(here, '_templates', 'basenames.txt')
    filename = os.path.join(here, '_generated', 'basenames.txt')

    try:
        os.makedirs(os.path.dirname(filename))
    except FileExistsError:
        pass

    shutil.copyfile(origfile, filename)

    from oggm.cfg import BASENAMES

    cnt = ['    ']
    for k in sorted(BASENAMES.keys()):
        cnt += [BASENAMES.info_str(k)] + ['    ']
    cnt = '\n'.join(cnt)

    file = open(filename, 'a')
    try:
        file.write(cnt)
    finally:
        file.close()
Exemple #3
0
def write_gdir_doc():
    """This is to write the docs for glacierdir automatically."""

    origfile = os.path.join(os.path.dirname(__file__), 'glacierdir.txt')
    filename = os.path.join(os.path.dirname(__file__), 'glacierdir-gen.rst')

    shutil.copyfile(origfile, filename)

    from oggm.cfg import BASENAMES

    cnt = ['    ']
    for k in sorted(BASENAMES.keys()):
        cnt += [BASENAMES.info_str(k)] + ['    ']
    cnt = '\n'.join(cnt)

    file = open(filename, 'a')
    try:
        file.write(cnt)
    finally:
        file.close()
Exemple #4
0
def write_gdir_doc():
    """This is to write the docs for glacierdir automatically."""

    origfile = os.path.join(os.path.dirname(__file__), "glacierdir.txt")
    filename = os.path.join(os.path.dirname(__file__), "glacierdir-gen.rst")

    shutil.copyfile(origfile, filename)

    from oggm.cfg import BASENAMES

    cnt = ["    "]
    for k in sorted(BASENAMES.keys()):
        cnt += [BASENAMES.info_str(k)] + ["    "]
    cnt = "\n".join(cnt)

    file = open(filename, "a")
    try:
        file.write(cnt)
    finally:
        file.close()