# http://pyrocko.org - GPLv3
#
# The pyrockoeost Developers, 21st Century
# ---|P------/S----------~Lg----------
'''
Compressed datafiles for the CRUST2.0 model by Laske, Masters and Reif.

Reference
---------

Please refer to the REM web site if you use this model:

    http://igppweb.ucsd.edu/~gabi/rem.html

or

Bassin, C., Laske, G. and Masters, G., The Current Limits of Resolution for
Surface Wave Tomography in North America, EOS Trans AGU, 81, F897, 2000. A
description of CRUST 5.1 can be found in: Mooney, Laske and Masters, Crust 5.1:
a global crustal model at 5x5 degrees, JGR, 103, 727-747, 1998.
'''

import bz2
import binascii


def split80(s):
    return '\n'.join([s[i:i+80] for i in range(0, len(s), 80)])


def encode(s):
    return split80(binascii.b2a_base64(bz2.compress(s.encode('latin-1'))))


def decode(s):
    return bz2.decompress(binascii.a2b_base64(s)).decode().lstrip()


readme = '''
QlpoOTFBWSZTWcRGC08AABx/gAtSQgBw7//yf//f4L////BgCo2222rdnLj6dGvb1i8dh2mEkQW2CUFh
oIJomaBNBNNHpR6TRkzUyZNGEBpkb1CAanpMgCRqeTVPSekZDQNAAA0AAAAanoEFNpNU9HqZNTTTIAAA
AANAAaBKekiFPKm0RoTR6E00ADQAAAAA0DgGEYTTEMAgGQAwjTJkwjAQ0EiQjIARNGmpppMoafqRhB6g
DRsoANDSmBmDFQE3XgoGCflY2ULLitODW97otTUQDvxlYiyHgbrmqVNFSnIdxZkB2KShCeTdvy/g5Z2M
JXTZmYBVTWlBpE2aEYxTkMb0+62L0kdy3og4Lywmw13ldNwEir2OCKfeuJi6UJpgRtXzoaGHHClBkpWg
fXe66M1u3aO9jqRrxRThDcsk49MTxTKyHBGkICUtt/aMS4bVTAJsh03XhwkLSHAutmIjBPf+UGGAjjL4
8WjCVuXmvwDmlpm1GrNQiZF06GNJxlUhJdxyMoblNzq+bLXB1UMYYJXnCpwoO0WilpqwLIZklSuQDkqd
UghB8k0LplnuLY7x1Gq2OLM4jFEqkCUKH+x0d4BgCPH+sZ+jG+zFhbSettVYKjdO0yDwFSBDy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yWLGv0MEZSrRjAR7L4dje+9r2chi0dp0mc1Fm
L9N5DpruXbUaNXW3aysycyayGDiGLNTLDXV2LwOBOIa3Rk6KhzlJ2EzDtZh0sLepCJfFScsXrmpTucrp
xRpXiMNw4WqqBzVqicXdUGFlZju7d2W7nB7W0FbVJOPBx5dM1daVbjHeKFdCJreWsaypbFjvIfzhCYvN
P2qWCNC42J4NGLRvYrWjd8Z3kDfexbMxxtcpllrxCXTJc2dCUtIgiUq1VLW8mxd30IVqn7YgWO4UQsTF
BrRRjA3trSseQWFDRgwigFr5pbkwmuNzNWv4RgrZXSJktwMwzJDUzdSLe4ZedhbN8LI/MWDZUb8SD7rr
bKmMg6+XObZNe/FemEHyULktNAF926oDYjTtAX8ifTpcxxRyCS2nPxp9hKwxqiuaCBnraRJg29IXvPm+
H5bHNPo734u4TPasVMEV9ysOJcxZ1AYo8Byrajt9/yNn/xdyRThQkMRGC08=
'''


type2_key = '''
[encoded data, 8748 characters]
rgYmoEtuXeG4CIh1cyhqBFdgP/xdyRThQkDnUseE
'''

type2 = '''
[encoded data, 9720 characters]
QZEH4Jw=
'''

elevation = '''
[encoded data, 39933 characters]
zX8JXQ==
'''
