From 026b7701ca3be6e56461bb81d592d3875e7bb1c6 Mon Sep 17 00:00:00 2001 From: tsutterley Date: Fri, 30 Aug 2019 16:20:32 -0700 Subject: [PATCH] specify yaml loader (PyYAML yaml.load(input) Deprecation) GFZ RL06 GRFO still requires the regex for removing colons use base yaml loader --- read_GRACE_harmonics/__init__.py | 2 +- read_GRACE_harmonics/read_GRACE_harmonics.py | 7 ++++--- setup.py | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/read_GRACE_harmonics/__init__.py b/read_GRACE_harmonics/__init__.py index e0de5e39..20a1e9f2 100644 --- a/read_GRACE_harmonics/__init__.py +++ b/read_GRACE_harmonics/__init__.py @@ -1 +1 @@ -from read_GRACE_harmonics import read_GRACE_harmonics +from read_GRACE_harmonics.read_GRACE_harmonics import read_GRACE_harmonics diff --git a/read_GRACE_harmonics/read_GRACE_harmonics.py b/read_GRACE_harmonics/read_GRACE_harmonics.py index 7b4c9deb..c11332ba 100755 --- a/read_GRACE_harmonics/read_GRACE_harmonics.py +++ b/read_GRACE_harmonics/read_GRACE_harmonics.py @@ -1,7 +1,7 @@ #!/usr/bin/env python u""" read_GRACE_harmonics.py -Written by Tyler Sutterley (07/2019) +Written by Tyler Sutterley (08/2019) Reads GRACE datafile and extracts spherical harmonic data and drift rates (RL04) Adds drift rates to clm and slm for release 4 harmonics @@ -31,6 +31,7 @@ PyYAML: YAML parser and emitter for Python (https://github.com/yaml/pyyaml) UPDATE HISTORY: + Updated 08/2019: specify yaml loader (PyYAML yaml.load(input) Deprecation) Updated 07/2019: replace colons in yaml header if within quotations Updated 11/2018: decode gzip read with ISO-8859-1 for python3 compatibility Updated 05/2018: updates to file name structure with release 6 and GRACE-FO @@ -129,8 +130,8 @@ def read_GRACE_harmonics(input_file, LMAX, MMAX=None, POLE_TIDE=False): head = [re.sub(r'\"(.*?)\:\s(.*?)\"',r'"\1, \2"',l) for l in file_contents if not re.match('{0}|GRDOTA'.format(FLAG),l)] if ((N == 'GRAC') and (DREL >= 6)) or (N == 'GRFO'): - #-- parse the YAML header for RL06 or GRACE-FO - grace_L2_input.update(yaml.load('\n'.join(head))) + #-- parse the YAML header for RL06 or GRACE-FO (specifying yaml loader) + grace_L2_input.update(yaml.load('\n'.join(head),Loader=yaml.BaseLoader)) else: #-- save lines of the GRACE file header removing empty lines grace_L2_input['header'] = [l.rstrip() for l in head if l] diff --git a/setup.py b/setup.py index 7979ac7e..201f50bb 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,8 @@ from setuptools import setup, find_packages setup( name='read-GRACE-harmonics', - version='1.0.0.5', - description='Reads Level-2 spherical harmonic coefficients from the NASA/DLR Gravity Recovery and Climate Experiment (GRACE) mission', + version='1.0.0.6', + description='Reads Level-2 spherical harmonic coefficients from the NASA/DLR GRACE and NASA/GFZ GRACE Follow-on missions', url='https://github.com/tsutterley/read-GRACE-harmonics', author='Tyler Sutterley', author_email='tsutterl@uw.edu', @@ -15,7 +15,7 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', ], - keywords='GRACE Gravity Spherical Harmonics', + keywords='GRACE, GRACE-FO, Gravity, satellite geodesy, spherical harmonics', packages=find_packages(), install_requires=['numpy','pyyaml'], )