Skip to content

Commit

Permalink
feat: add EGM2008 interpolation programs for ICESat+OIB (#36)
Browse files Browse the repository at this point in the history
fix: read cases in ATM level-2 data where a line is empty
  • Loading branch information
tsutterley authored May 21, 2024
1 parent 2ebfb93 commit e080cf1
Show file tree
Hide file tree
Showing 8 changed files with 825 additions and 11 deletions.
19 changes: 19 additions & 0 deletions doc/source/api_reference/geoid/interp_EGM2008_ICESat_GLA12.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
==============================
interp_EGM2008_ICESat_GLA12.py
==============================

- Reads EGM2008 geoid height spatial grids from unformatted binary files provided by the National Geospatial-Intelligence Agency and interpolates to ICESat/GLAS L2 GLA12 Antarctic and Greenland Ice Sheet elevation data

`Source code`__

.. __: https://github.com/tsutterley/Grounding-Zones/blob/main/geoid/interp_EGM2008_ICESat_GLA12.py

Calling Sequence
################

.. argparse::
:filename: interp_EGM2008_ICESat_GLA12.py
:func: arguments
:prog: interp_EGM2008_ICESat_GLA12.py
:nodescription:
:nodefault:
19 changes: 19 additions & 0 deletions doc/source/api_reference/geoid/interp_EGM2008_icebridge_data.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
================================
interp_EGM2008_icebridge_data.py
================================

- Reads EGM2008 geoid height spatial grids from unformatted binary files provided by the National Geospatial-Intelligence Agency and interpolates to Operation IceBridge elevation data

`Source code`__

.. __: https://github.com/tsutterley/Grounding-Zones/blob/main/geoid/interp_EGM2008_icebridge_data.py

Calling Sequence
################

.. argparse::
:filename: interp_EGM2008_icebridge_data.py
:func: arguments
:prog: interp_EGM2008_icebridge_data.py
:nodescription:
:nodefault:
2 changes: 2 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ Python Tools for Estimating Ice Sheet Grounding Zone Locations with data from NA
api_reference/geoid/compute_geoid_ICESat2_ATL10.rst
api_reference/geoid/compute_geoid_ICESat2_ATL11.rst
api_reference/geoid/compute_geoid_ICESat2_ATL12.rst
api_reference/geoid/interp_EGM2008_icebridge_data.rst
api_reference/geoid/interp_EGM2008_ICESat_GLA12.rst

.. toctree::
:maxdepth: 1
Expand Down
2 changes: 1 addition & 1 deletion geoid/compute_geoid_ICESat_GLA12.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def HDF5_GLA12_geoid_write(IS_gla12_geoid, IS_gla12_attrs,
# PURPOSE: create argument parser
def arguments():
parser = argparse.ArgumentParser(
description="""Calculates geoid undunations for correcting ICESat/GLAS
description="""Calculates geoid undulations for correcting ICESat/GLAS
L2 GLA12 Antarctic and Greenland Ice Sheet elevation data
""",
fromfile_prefix_chars="@"
Expand Down
15 changes: 6 additions & 9 deletions geoid/compute_geoid_icebridge_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,8 @@ def compute_geoid_icebridge_data(model_file, arg, LMAX=None, LOVE=None,
attrib['geoid_free2mean'] = {}
attrib['geoid_free2mean']['units'] = 'm'
attrib['geoid_free2mean']['long_name'] = 'Geoid_Free-to-Mean_conversion'
args = (Ylms['modelname'],Ylms['max_degree'])
attrib['geoid_free2mean']['description'] = ('Additive value to convert '
'geoid heights from the tide-free system to the mean-tide system')
attrib['geoid_free2mean']['tide_system'] = Ylms['tide_system']
attrib['geoid_free2mean']['description'] = ('Additive_value_to_convert_'
'geoid_heights_from_the_tide-free_system_to_the_mean-tide_system')
attrib['geoid_free2mean']['earth_gravity_constant'] = GM
attrib['geoid_free2mean']['radius'] = R
attrib['geoid_free2mean']['coordinates'] = 'lat lon'
Expand Down Expand Up @@ -203,7 +201,7 @@ def compute_geoid_icebridge_data(model_file, arg, LMAX=None, LOVE=None,
dinput, file_lines, HEM = gz.io.icebridge.read_LVIS_HDF5_file(
input_file, input_subsetter)

# output tidal HDF5 file
# output geoid HDF5 file
# form: rg_NASA_model_GEOID_WGS84_fl1yyyymmddjjjjj.H5
# where rg is the hemisphere flag (GR or AN) for the region
# model is the geoid model name flag
Expand Down Expand Up @@ -243,8 +241,8 @@ def compute_geoid_icebridge_data(model_file, arg, LMAX=None, LOVE=None,
data=dinput[key][:], dtype=dinput[key].dtype,
compression='gzip')
# add HDF5 variable attributes
for att_name,att_val in attributes:
h5.attrs[att_name] = att_val
for att_name,att_val in attributes.items():
h5[key].attrs[att_name] = att_val
# attach dimensions
if key not in ('time',):
for i,dim in enumerate(['time']):
Expand All @@ -254,8 +252,7 @@ def compute_geoid_icebridge_data(model_file, arg, LMAX=None, LOVE=None,
# HDF5 file attributes
fid.attrs['featureType'] = 'trajectory'
fid.attrs['title'] = 'Geoid_height_for_elevation_measurements'
fid.attrs['summary'] = ('Geoid_undulation_computed_at_elevation_'
'measurements_using_a_tidal_model_driver.')
fid.attrs['summary'] = 'Geoid_undulation_computed_at_elevation_measurements'
fid.attrs['project'] = 'NASA_Operation_IceBridge'
fid.attrs['processing_level'] = '4'
fid.attrs['date_created'] = time.strftime('%Y-%m-%d',time.localtime())
Expand Down
Loading

0 comments on commit e080cf1

Please sign in to comment.