Skip to content

Commit

Permalink
Merge branch 'develop' into feature_1319_no_pickle
Browse files Browse the repository at this point in the history
  • Loading branch information
John Halley Gotway committed Mar 31, 2021
2 parents f58e335 + 6055600 commit ebd57f9
Show file tree
Hide file tree
Showing 195 changed files with 1,811 additions and 898 deletions.
4 changes: 3 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

- [ ] Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:</br>

- [ ] Do these changes include sufficient documentation and testing updates? **[Yes or No]**
- [ ] Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? **[Yes or No]**

- [ ] Do these changes include sufficient testing updates? **[Yes or No]**

- [ ] Will this PR result in changes to the test suite? **[Yes or No]**</br>
If **yes**, describe the new output and/or changes to the existing output:</br>
Expand Down
23 changes: 23 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build all formats (htmlzip, pdf, epub)
#formats: all
formats: []

# Optionally set the version of Python and requirements required to build your
# docs
python:
version: 3.7
install:
- requirements: met/docs/requirements.txt

# Configuration for Sphinx documentation (this is the default documentation
# type)
sphinx:
builder: html
configuration: met/docs/conf.py
12 changes: 12 additions & 0 deletions met/data/config/TCStatConfig_default
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ column_thresh_val = [];
column_str_name = [];
column_str_val = [];

//
// Stratify by excluding strings in non-numeric data columns.
//
column_str_exc_name = [];
column_str_exc_val = [];

//
// Similar to the column_thresh options above
//
Expand All @@ -123,6 +129,12 @@ init_thresh_val = [];
init_str_name = [];
init_str_val = [];

//
// Similar to the column_str_exc options above
//
init_str_exc_name = [];
init_str_exc_val = [];

//
// Stratify by the ADECK and BDECK distances to land.
//
Expand Down
8 changes: 3 additions & 5 deletions met/data/wrappers/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ wrappersdir = $(pkgdatadir)/wrappers
wrappers_DATA = \
generic_python.py \
generic_pickle.py \
read_tmp_dataplane.py \
write_tmp_dataplane.py \
read_pickle_dataplane.py \
write_pickle_dataplane.py \
write_pickle_mpr.py \
read_tmp_ascii.py \
write_pickle_point.py \
write_tmp_point.py
write_pickle_point.py

EXTRA_DIST = ${wrappers_DATA}

Expand Down
15 changes: 15 additions & 0 deletions met/data/wrappers/read_pickle_dataplane.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
########################################################################
#
# Reads temporary pickle file into memory.
#
# usage: /path/to/python read_pickle_dataplane.py pickle.tmp
#
########################################################################

import sys
import numpy as np
import pickle

print('Python Script:\t', sys.argv[0])
print('Load Pickle:\t', sys.argv[1])
met_info = pickle.load(open(sys.argv[1], "rb"))
49 changes: 0 additions & 49 deletions met/data/wrappers/read_tmp_ascii.py

This file was deleted.

36 changes: 0 additions & 36 deletions met/data/wrappers/read_tmp_dataplane.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,40 @@
# Adapted from a script provided by George McCabe
# Adapted by Randy Bullock
#
# usage: /path/to/python write_tmp_point.py \
# tmp_ascii_output_filename <user_python_script>.py <args>
# usage: /path/to/python write_pickle_dataplane.py \
# pickle_output_filename <user_python_script>.py <args>
#
########################################################################

import os
import sys
import pickle
import importlib.util
import xarray as xr

print('Python Script:\t', sys.argv[0])
print('User Command:\t', sys.argv[2:])
print('Write Temporary Ascii:\t', sys.argv[1])
print('Write Pickle:\t', sys.argv[1])

tmp_filename = sys.argv[1]
pickle_filename = sys.argv[1]

pyembed_module_name = sys.argv[2]
sys.argv = sys.argv[2:]

if not pyembed_module_name.endswith('.py'):
pyembed_module_name += '.py'

user_base = os.path.basename(pyembed_module_name).replace('.py','')

spec = importlib.util.spec_from_file_location(user_base, pyembed_module_name)
met_in = importlib.util.module_from_spec(spec)
spec.loader.exec_module(met_in)

f = open(tmp_filename, 'w')
for line in met_in.point_data:
f.write(str(line) + '\n')
if isinstance(met_in.met_data, xr.DataArray):
met_info = { 'attrs': met_in.met_data.attrs, 'met_data': met_in.met_data }
else:
met_info = { 'attrs': met_in.attrs, 'met_data': met_in.met_data }

print(met_info)

pickle.dump( met_info, open( pickle_filename, "wb" ) )
5 changes: 1 addition & 4 deletions met/data/wrappers/write_pickle_mpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
print('Write Pickle:\t', sys.argv[1])

pickle_filename = sys.argv[1]
tmp_filename = pickle_filename + '.txt'

pyembed_module_name = sys.argv[2]
sys.argv = sys.argv[2:]
Expand All @@ -29,8 +28,6 @@
met_in = importlib.util.module_from_spec(spec)
spec.loader.exec_module(met_in)

f = open(tmp_filename, 'w')
for line in met_in.mpr_data:
f.write(str(line) + '\n')
print(met_in)

pickle.dump( met_in.mpr_data, open( pickle_filename, "wb" ) )
5 changes: 0 additions & 5 deletions met/data/wrappers/write_pickle_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
print('Write Pickle:\t', sys.argv[1])

pickle_filename = sys.argv[1]
tmp_filename = pickle_filename + '.txt'

pyembed_module_name = sys.argv[2]
sys.argv = sys.argv[2:]
Expand All @@ -29,8 +28,4 @@
met_in = importlib.util.module_from_spec(spec)
spec.loader.exec_module(met_in)

f = open(tmp_filename, 'w')
for line in met_in.point_data:
f.write(str(line) + '\n')

pickle.dump( met_in.point_data, open( pickle_filename, "wb" ) )
68 changes: 0 additions & 68 deletions met/data/wrappers/write_tmp_dataplane.py

This file was deleted.

30 changes: 26 additions & 4 deletions met/docs/Users_Guide/appendixF.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ The data must be loaded into a 2D NumPy array named **met_data**. In addition th
'long_name': 'FooBar',
'level': 'Surface',
'units': 'None',
# Define 'grid' as a string or a dictionary
'grid': {
'type': 'Lambert Conformal',
'hemisphere': 'N',
Expand All @@ -83,12 +85,32 @@ The data must be loaded into a 2D NumPy array named **met_data**. In addition th
'ny': 129,
}
}
}
In the dictionary, valid time, initialization time, lead time and accumulation time (if any) must be indicated by strings. Valid and initialization times must be given in YYYYMMDD[_HH[MMSS]] format, and lead and accumulation times must be given in HH[MMSS] format, where the square brackets indicate optional elements. The dictionary must also include strings for the name, long_name, level, and units to describe the data. The rest of the **attrs** dictionary gives the grid size and projection information in the same format that is used in the netCDF files written out by the MET tools. Those entries are also listed below. Note that the **grid** entry in the **attrs** dictionary can either be defined as a string or as a dictionary itself.

If specified as a string, **grid** can be defined as follows:

• As a named grid:

.. code-block:: none
'grid': 'G212'
• As a grid specification string, as described in :ref:`appendixB`:

.. code-block:: none
'grid': 'lambert 185 129 12.19 -133.459 -95 40.635 6371.2 25 25 N'
• As the path to an existing gridded data file:

.. code-block:: none
In the dictionary, valid time, initialization time, lead time and accumulation time (if any) must be indicated by strings. Valid and initialization times must be given in YYYYMMDD[_HH[MMSS]] format, and lead and accumulation times must be given in HH[MMSS] format, where the square brackets indicate optional elements. The dictionary must also include strings for the name, long_name, level, and units to describe the data. The rest of the **attrs** dictionary gives the grid size and projection information in the same format that is used in the netCDF files written out by the MET tools. Those entries are also listed below. Note that the **grid** entry in the **attrs** dictionary is itself a dictionary.
'grid': '/path/to/sample_data.grib'
The supported grid **type** strings are described below:
When specified as a dictionary, the contents of the **grid** dictionary vary based on the grid **type** string. The entries for the supported grid types are described below:

• **Lambert Conformal** grid dictionary entries:

Expand Down

0 comments on commit ebd57f9

Please sign in to comment.