Skip to content
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

merge request for release 0.3.1 #53

Merged
merged 35 commits into from
Jul 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
507f4d1
update docs, pygrib not available for windows
May 26, 2015
72feaca
initial commit
aplocon May 13, 2015
5fb99c6
created
aplocon May 20, 2015
e882497
replaced genio templates with dictionaries
aplocon May 20, 2015
f02ac91
created
aplocon May 29, 2015
8d88880
changed result_template
aplocon May 29, 2015
71b1ae9
major changes
aplocon May 29, 2015
d8ece0b
deleted
aplocon Jun 1, 2015
d4f4072
major changes
aplocon Jun 2, 2015
3de2d3f
handled exceptions
aplocon Jun 2, 2015
9144e70
cleaned code
aplocon Jun 2, 2015
3e31829
added documentation
aplocon Jun 3, 2015
08ca60b
minor adds
aplocon Jun 3, 2015
a00ce30
renamed read_ssm to read_ts, returned ASCATTimeSeries().data
aplocon Jun 3, 2015
fde5527
cleaned code
aplocon Jun 3, 2015
6c12351
small changes
aplocon Jun 8, 2015
c9b36fc
corrected LUTs usage
aplocon Jun 8, 2015
01cd655
replaced use_lut with get_luts
aplocon Jun 8, 2015
ad4517d
drop nan values after read, made reference grid optional
aplocon Jun 11, 2015
ec89033
changed setup_code path to example ASCAT ISMN
aplocon Jun 11, 2015
2c92716
checked in get_processing_jobs if reference grid exists
aplocon Jun 11, 2015
ea70a98
added comments
aplocon Jun 11, 2015
aa5820a
added ipython to optional_requirements
aplocon Jun 11, 2015
2197228
added example validation ASCAT ISMN
aplocon Jun 11, 2015
51590b9
add validation framework examples to documentation
Jul 2, 2015
c828870
add back read_ssm to not break api
Jul 2, 2015
70e7dc3
remove test data from repo
Jul 3, 2015
8bc3a96
add submodule for test data
Jul 3, 2015
6e05a57
set correct paths to test data submodule
Jul 3, 2015
b642a9d
update test-data submodule
Jul 3, 2015
75eeb6f
update submodule url to https for travis test
Jul 3, 2015
5792145
fix tests for python3, orbit_dir is a byte in python3
Jul 3, 2015
54ae2c8
fix #49 do not drop na values
Jul 6, 2015
426d3dc
fix #51 by using NearestNDInterpolator
cpaulik Jul 8, 2015
1381018
update release notes for v0.3.1
cpaulik Jul 8, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tests/test-data"]
path = tests/test-data
url = https://github.com/TUW-GEO/pytesmo-test-data.git
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v0.3.1, 2015-07-09
* added validation framework and example on how to use it
* fix bug (issue #51) in temporal matching
* added test data as git submodule

# v0.3.0, 2015-05-26
* added calculation of pearson R confidence intervals based on fisher z transform
* ISMN reader can now get the data coverage for stations and networks
Expand Down
113 changes: 113 additions & 0 deletions docs/data_preparation_ASCAT_ISMN.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example data preparation ASCAT - ISMN"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The validation framework allows users to prepare their data before the validation is performed by using the **DataPreparation** class which must contain two methods:\n",
"* ***prep_reference***, has at least one parameter - the reference dataframe\n",
"* ***prep_other***, has at least two parameters - the other dataframe and the name of the dataset"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"class DataPreparation(object):\n",
" \"\"\"\n",
" Class for preparing the data before validation.\n",
" \"\"\"\n",
" @staticmethod\n",
" def prep_reference(reference):\n",
" \"\"\"\n",
" Static method used to prepare the reference dataset (ISMN).\n",
"\n",
" Parameters\n",
" ----------\n",
" reference : pandas.DataFrame\n",
" ISMN data.\n",
"\n",
" Returns\n",
" -------\n",
" reference : pandas.DataFrame\n",
" Masked reference.\n",
" \"\"\"\n",
" return reference\n",
"\n",
" @staticmethod\n",
" def prep_other(other, other_name, mask_snow=80, mask_frozen=80, mask_ssf=[0, 1]):\n",
" \"\"\"\n",
" Static method used to prepare the other datasets (ASCAT).\n",
"\n",
" Parameters\n",
" ----------\n",
" other : pandas.DataFrame\n",
" Containing at least the fields: sm, frozen_prob, snow_prob, ssf.\n",
" other_name : string\n",
" ASCAT.\n",
" mask_snow : int, optional\n",
" If set, all the observations with snow probability > mask_snow\n",
" are removed from the result. Default: 80.\n",
" mask_frozen : int, optional\n",
" If set, all the observations with frozen probability > mask_frozen\n",
" are removed from the result. Default: 80.\n",
" mask_ssf : list, optional\n",
" If set, all the observations with ssf != mask_ssf are removed from\n",
" the result. Default: [0, 1].\n",
"\n",
" Returns\n",
" -------\n",
" reference : pandas.DataFrame\n",
" Masked reference.\n",
" \"\"\"\n",
" if other_name == 'ASCAT':\n",
"\n",
" # mask frozen\n",
" if mask_frozen is not None:\n",
" other = other[other['frozen_prob'] < mask_frozen]\n",
"\n",
" # mask snow\n",
" if mask_snow is not None:\n",
" other = other[other['snow_prob'] < mask_snow]\n",
"\n",
" # mask ssf\n",
" if mask_ssf is not None:\n",
" other = other[(other['ssf'] == mask_ssf[0]) |\n",
" (other['ssf'] == mask_ssf[1])]\n",
" return other"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
74 changes: 74 additions & 0 deletions docs/data_preparation_ASCAT_ISMN.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

Example data preparation ASCAT - ISMN
=====================================

The validation framework allows users to prepare their data before the
validation is performed by using the **DataPreparation** class which
must contain two methods: \* ***prep\_reference***, has at least one
parameter - the reference dataframe \* ***prep\_other***, has at least
two parameters - the other dataframe and the name of the dataset

.. code:: python

class DataPreparation(object):
"""
Class for preparing the data before validation.
"""
@staticmethod
def prep_reference(reference):
"""
Static method used to prepare the reference dataset (ISMN).

Parameters
----------
reference : pandas.DataFrame
ISMN data.

Returns
-------
reference : pandas.DataFrame
Masked reference.
"""
return reference

@staticmethod
def prep_other(other, other_name, mask_snow=80, mask_frozen=80, mask_ssf=[0, 1]):
"""
Static method used to prepare the other datasets (ASCAT).

Parameters
----------
other : pandas.DataFrame
Containing at least the fields: sm, frozen_prob, snow_prob, ssf.
other_name : string
ASCAT.
mask_snow : int, optional
If set, all the observations with snow probability > mask_snow
are removed from the result. Default: 80.
mask_frozen : int, optional
If set, all the observations with frozen probability > mask_frozen
are removed from the result. Default: 80.
mask_ssf : list, optional
If set, all the observations with ssf != mask_ssf are removed from
the result. Default: [0, 1].

Returns
-------
reference : pandas.DataFrame
Masked reference.
"""
if other_name == 'ASCAT':

# mask frozen
if mask_frozen is not None:
other = other[other['frozen_prob'] < mask_frozen]

# mask snow
if mask_snow is not None:
other = other[other['snow_prob'] < mask_snow]

# mask ssf
if mask_ssf is not None:
other = other[(other['ssf'] == mask_ssf[0]) |
(other['ssf'] == mask_ssf[1])]
return other
17 changes: 17 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ It can be found in the /examples folder of the pytesmo package under the name co
.. include::
compare_ASCAT_ISMN.rst

Comparison of ASCAT and ISMN using the pytesmo validation framework
===================================================================

The pytesmo validation framework uses IPython to do a comparison of two or more
datasets using parallel processing. The validation frameworks also stores the
results as a CF compliant netCDF file.

.. include::
setup_validation_ASCAT_ISMN.rst

If custom data preparation e.g. special masking is necessary before the data
comparison then a custom DataPreparation class can be used. The following shows
an example of such a class:

.. include::
data_preparation_ASCAT_ISMN.rst

Triple collocation and triple collocation based scaling
=======================================================

Expand Down
3 changes: 1 addition & 2 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ Windows

A relatively easy way to install everything but matplotlib-basemap and netCDF4
is to install `WinPython <https://winpython.github.io/>`_ and then
download basemap, netCDF4 and, if you want to read the H14 product, the pygrib
installer from http:https://www.lfd.uci.edu/~gohlke/pythonlibs/. Add them to your
download basemap and netCDF4 from http:https://www.lfd.uci.edu/~gohlke/pythonlibs/. Add them to your
winpython installation using the winpython Control Panel.

Just make sure that you download both for the same architecture (32/64 bit) and
Expand Down
Loading