-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to serialize a Tide to JSON #10
Open
fawkesley
wants to merge
15
commits into
sam-cox:master
Choose a base branch
from
unknown repository
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add a test runner script which runs any units tests using nosetests (there currently aren't any) and will eventually run PEP8 tests. This will run on Travis CI after visiting https://travis-ci.org/profile and enabling it for the repo. In Travis CI, we need to use system site packages for numpy and scipy, see: http://danielnouri.org/notes/2012/11/23/use-apt-get-to-install-python-dependencies-for-travis-ci/ For Travis to try to install the right packages (not numpy/scipy), create two requirements files: `requirements/_common.txt` and `requirements/_numpy_and_scipy.txt`. As a developer, you can install `./requirements.txt`. As Travis, you can install `./requirements_for_travis.txt` In the `.travis.yml` file we also use the environment variables for ATLAS, BLAS etc as suggested by Sam in the README: ``` export LAPACK=/usr/lib/liblapack.so export ATLAS=/usr/lib/libatlas.so export BLAS=/usr/lib/libblas.so ```
- tide.py - constituents.py - astro.py - nodal_corrections.py http://legacy.python.org/dev/peps/pep-0008/
The purpose of these classes is to make a convenient way to load observation data (datetime, height) from a source such as CSV, and handle any wrangling to ie numpy when required. - `Observations` is an abstract-base-class defining a basic interface which all subclasses must adhere to. - `CsvObservations` reads observations from an arbitrary-sized CSV with UTC dates. Note that it tries to avoid reading the file into memory. - Tests for CsvObservations which capture its behaviour. Included is an example data set from the NOAA with hourly observations for the year of 2013.
This is a regression test to pin the behaviour of pytides doing a full analysis for `example_observations_2.csv` Note that it depends on the new `CsvObservations` class.
They are helper functions, not class methods. Simplify the class.
Previously: BaseConstituent | CompoundConstituent But `CompoundConstituent` does *not* have an "is-a" relationship with BaseConstituent (although it has common features). This commit renames `BaseConstituent` to `Constituent` and introduces a new `BaseConstituent` which provides any common functionality, and dictates what functionality must be provided by the subclass. BaseConstituent (new) | | Constituent CompoundConstituent
Split out BaseConstituent, Constituent and CompoundConstituent as they are functionality quite different. Move the actual constituent defintions into a new file `constituent_factory` which will soon have factory methods for creating a constituent [set] from a name.
…mp-master-new-data
- `get_constituent(name)` - get a constituent object based on a name (allows aliasing constituents for different naming conventions) - `get_constituent_set(name` - get a set of constituents, ie NOAA
- add `json_encoding.py` module providing PytidesJson{Encoder,Decoder} - add `serialize` and `deserialize` methods to `BaseConstituent` and `Tide` classes Note that a constituent can be fully reconstructed from its name alone, so we don't need to serialize derivative member methods like coefficients. For a Tide, we reconstruct the model (a numpy object) which comprises triples of Constituent, Amplitude, Phase.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
json_encoding.py
module providing PytidesJson{Encoder,Decoder}serialize
anddeserialize
methods toBaseConstituent
andTide
classesNote that a constituent can be fully reconstructed from its name alone,
so we don't need to serialize derivative member methods like
coefficients.
For a Tide, we reconstruct the model (a numpy object) which comprises
triples of Constituent, Amplitude, Phase.