Skip to content

Commit

Permalink
Merge pull request #66 from TUW-GEO/develop
Browse files Browse the repository at this point in the history
Release v0.3.4
  • Loading branch information
cpaulik committed Oct 27, 2015
2 parents cc9e845 + 35958a9 commit 523a066
Show file tree
Hide file tree
Showing 14 changed files with 764 additions and 564 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -13,6 +13,7 @@ python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
install:
# You may want to periodically update this, although the conda update
# conda line below will keep everything up-to-date. We do this
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.md
@@ -1,3 +1,9 @@
# v0.3.4, 2015-10-23

* fix #63 by moving data preparation before period checks
* fix bug in exponential and boxcar filter. Problem was that nan values were not
ignored correctly

# v0.3.3, 2015-08-26

* add option to temporal resampling to exclude window boundaries
Expand Down
47 changes: 34 additions & 13 deletions appveyor.yml
Expand Up @@ -6,39 +6,55 @@ environment:
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_compiler.cmd"

matrix:
- PYTHON: "C:\\Python27"
- PYTHON: "C:\\Python27_32"
PYTHON_VERSION: "2.7.8"
PYTHON_ARCH: "32"
MINICONDA_VERSION: ""

- PYTHON: "C:\\Python27-x64"
- PYTHON: "C:\\Python27_64"
PYTHON_VERSION: "2.7.8"
PYTHON_ARCH: "64"
MINICONDA_VERSION: ""

- PYTHON: "C:\\Python33"
PYTHON_VERSION: "3.3.5"
- PYTHON: "C:\\Python33_32"
PYTHON_VERSION: "3.3"
PYTHON_ARCH: "32"
MINICONDA_VERSION: "3"

- PYTHON: "C:\\Python33-x64"
PYTHON_VERSION: "3.3.5"
- PYTHON: "C:\\Python33_64"
PYTHON_VERSION: "3.3"
PYTHON_ARCH: "64"
MINICONDA_VERSION: "3"

- PYTHON: "C:\\Python34"
- PYTHON: "C:\\Python34_32"
PYTHON_VERSION: "3.4.1"
PYTHON_ARCH: "32"
MINICONDA_VERSION: "3"

- PYTHON: "C:\\Python34-x64"
- PYTHON: "C:\\Python34_64"
PYTHON_VERSION: "3.4.1"
PYTHON_ARCH: "64"
MINICONDA_VERSION: "3"

- PYTHON: "C:\\Python35_32"
PYTHON_VERSION: "3.5"
PYTHON_ARCH: "32"
MINICONDA_VERSION: "3"

- PYTHON: "C:\\Python35_64"
PYTHON_VERSION: "3.5"
PYTHON_ARCH: "64"
MINICONDA_VERSION: "3"

install:
- "git submodule update --init --recursive"
- ECHO "Filesystem root:"
- ps: "ls \"C:/\""

- ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""

# Install Python (from the official .msi of http://python.org) and pip when
# not already installed.
# install miniconda with the powershell script install.ps1
- "powershell ./appveyor/install.ps1"

# Prepend newly installed Python to the PATH of this build (this cannot be
Expand All @@ -54,14 +70,19 @@ install:
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- "%CMD_IN_ENV% pip install cython"
- "%CMD_IN_ENV% pip install -i https://pypi.binstar.org/carlkl/simple numpy"
- "conda update --yes conda"
- "conda create -q --yes -n test python=%PYTHON_VERSION% numpy scipy pandas statsmodels netCDF4 cython pytest pip matplotlib pyproj"
- "activate test"
- "pip install pygeogrids"
- "pip install pyresample"
- "python --version"
- "where python"

build: false # Not a C# project, build stuff at the test step instead.

test_script:
# Build the compiled extension and run the project tests
- "echo Skipped"
- "%CMD_IN_ENV% python setup.py test"

after_test:
# If tests are successful, create a whl package for the project.
Expand Down
76 changes: 31 additions & 45 deletions appveyor/install.ps1
@@ -1,16 +1,15 @@
# Sample script to install Python and pip under Windows
# Authors: Olivier Grisel and Kyle Kastner
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
# Sample script to install anaconda under windows
# Authors: Stuart Mumford
# Borrwed from: Olivier Grisel and Kyle Kastner
# License: BSD 3 clause

$BASE_URL = "https://www.python.org/ftp/python/"
$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
$GET_PIP_PATH = "C:\get-pip.py"
$MINICONDA_URL = "http://repo.continuum.io/miniconda/"


function DownloadPython ($python_version, $platform_suffix) {
function DownloadMiniconda ($miniconda_version, $platform_suffix) {
$webclient = New-Object System.Net.WebClient
$filename = "python-" + $python_version + $platform_suffix + ".msi"
$url = $BASE_URL + $python_version + "/" + $filename
$filename = "Miniconda" + $miniconda_version + "-latest" + "-Windows-" + $platform_suffix + ".exe"

$url = $MINICONDA_URL + $filename

$basedir = $pwd.Path + "\"
$filepath = $basedir + $filename
Expand All @@ -19,9 +18,9 @@ function DownloadPython ($python_version, $platform_suffix) {
return $filepath
}

# Download and retry up to 5 times in case of network transient errors.
# Download and retry up to 3 times in case of network transient errors.
Write-Host "Downloading" $filename "from" $url
$retry_attempts = 3
$retry_attempts = 2
for($i=0; $i -lt $retry_attempts; $i++){
try {
$webclient.DownloadFile($url, $filepath)
Expand All @@ -31,55 +30,42 @@ function DownloadPython ($python_version, $platform_suffix) {
Start-Sleep 1
}
}
Write-Host "File saved at" $filepath
if (Test-Path $filepath) {
Write-Host "File saved at" $filepath
} else {
# Retry once to get the error message if any at the last try
$webclient.DownloadFile($url, $filepath)
}
return $filepath
}


function InstallPython ($python_version, $architecture, $python_home) {
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
function InstallMiniconda ($miniconda_version, $architecture, $python_home) {
Write-Host "Installing miniconda" $miniconda_version "for" $architecture "bit architecture to" $python_home
if (Test-Path $python_home) {
Write-Host $python_home "already exists, skipping."
return $false
}
if ($architecture -eq "32") {
$platform_suffix = ""
$platform_suffix = "x86"
} else {
$platform_suffix = ".amd64"
$platform_suffix = "x86_64"
}
$filepath = DownloadPython $python_version $platform_suffix
$filepath = DownloadMiniconda $miniconda_version $platform_suffix
Write-Host "Installing" $filepath "to" $python_home
$args = "/qn /i $filepath TARGETDIR=$python_home"
Write-Host "msiexec.exe" $args
Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthru
Write-Host "Python $python_version ($architecture) installation complete"
return $true
}


function InstallPip ($python_home) {
$pip_path = $python_home + "/Scripts/pip.exe"
$python_path = $python_home + "/python.exe"
if (-not(Test-Path $pip_path)) {
Write-Host "Installing pip..."
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
Write-Host "Executing:" $python_path $GET_PIP_PATH
Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
$args = "/InstallationType=AllUsers /S /AddToPath=1 /RegisterPython=1 /D=" + $python_home
Write-Host $filepath $args
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
#Start-Sleep -s 15
if (Test-Path $python_home) {
Write-Host "Miniconda $miniconda_version ($architecture) installation complete"
} else {
Write-Host "pip already installed."
Write-Host "Failed to install Python in $python_home"
Exit 1
}
}

function InstallPackage ($python_home, $pkg) {
$pip_path = $python_home + "/Scripts/pip.exe"
& $pip_path install $pkg
}

function main () {
InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
InstallPip $env:PYTHON
InstallPackage $env:PYTHON wheel
InstallMiniconda $env:MINICONDA_VERSION $env:PYTHON_ARCH $env:PYTHON
}

main
2 changes: 1 addition & 1 deletion docs/Triple collocation.rst
Expand Up @@ -325,4 +325,4 @@ References
.. [Gruber_2015] Gruber, A., Su, C., Zwieback, S., Crow, W., Dorigo, W., Wagner, W.
(2015). Recent advances in (soil moisture) triple collocation analysis.
International Journal of Applied Earth Observation and Geoinformation,
in review
in press. 10.1016/j.jag.2015.09.002
24 changes: 13 additions & 11 deletions pytesmo/time_series/filtering.py
Expand Up @@ -15,7 +15,7 @@
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL VIENNA UNIVERSITY OF TECHNOLOGY,
# DISCLAIMED. IN NO EVENT SHALL VIENNA UNIVERSITY OF TECHNOLOGY,
# DEPARTMENT OF GEODESY AND GEOINFORMATION BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
Expand All @@ -36,17 +36,18 @@
from pytesmo.timedate.julian import julday
from pytesmo.time_series.filters import boxcar_filter


def moving_average(Ser,
window_size=1):
'''
Applies a moving average (box) filter on an input time series
Parameters
----------
Ser : pandas.Series (index must be a DateTimeIndex or julian date)
window_size : float, optional
The size of the moving_average window [days] that will be applied on the
The size of the moving_average window [days] that will be applied on the
input Series
Default: 1
Expand All @@ -57,15 +58,16 @@ def moving_average(Ser,
'''
# if index is datetimeindex then convert it to julian date
if type(Ser.index) == pd.DatetimeIndex:

jd_index = julday(Ser.index.month, Ser.index.day, Ser.index.year,
Ser.index.hour, Ser.index.minute, Ser.index.second)
Ser.index.hour, Ser.index.minute, Ser.index.second)

else:
jd_index = Ser.index.values

filtered = boxcar_filter(np.squeeze(Ser.values.astype(np.double)), jd_index.astype(np.double), window=window_size)

result = pd.Series(filtered, index=Ser.index)

filtered = boxcar_filter(np.squeeze(
Ser.values.astype(np.double)), jd_index.astype(np.double), window=window_size)

result = pd.Series(filtered, index=Ser.index)

return result

0 comments on commit 523a066

Please sign in to comment.