Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gehilley committed Sep 3, 2021
0 parents commit 4f7fa94
Show file tree
Hide file tree
Showing 207 changed files with 1,613,157 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
114 changes: 114 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
8 changes: 8 additions & 0 deletions .idea/Mammoth.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

702 changes: 702 additions & 0 deletions Analysis.ipynb

Large diffs are not rendered by default.

147 changes: 147 additions & 0 deletions AverageSGSSimulations.ipynb

Large diffs are not rendered by default.

522 changes: 522 additions & 0 deletions CalculateHSLStresses.ipynb

Large diffs are not rendered by default.

377 changes: 377 additions & 0 deletions ECFilteredTS.ipynb

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions EddyData.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import numpy as np
import csv

class EddyData():

def __init__(self, filename, time_offset = np.timedelta64(-8, 'h')):

time_offset = np.timedelta64(-8, 'h')
reader = csv.reader(open(filename,'r',encoding = 'utf-8-sig'), delimiter=',')
columns = None
self.data_structure = {}

for line in reader:
if columns is None:
columns = line[0:]
self.data_structure = {key:[] for key in columns}
else:
self.data_structure[columns[0]] += [np.datetime64(line[0])+time_offset]
for (key, data) in zip(columns[1:], line[1:]):
self.data_structure[key] += [np.float(data)]

self.data_structure[columns[0]] = np.array(self.data_structure[columns[0]], dtype = np.datetime64)
for key in columns[1:]:
self.data_structure[key] = np.array(self.data_structure[key])

def __apply_filtered_indexes(self, filtered_indexes):
for key in self.data_structure:
self.data_structure[key] = self.data_structure[key][filtered_indexes]

def filter_by_ustar(self, ustar):
i = np.where(np.all((self.data_structure['qc_co2_flux'] < 1, self.data_structure['ustar'] >= ustar), axis=0))
self.__apply_filtered_indexes(i)

def denoise(self, field):
from scipy.signal import detrend
from scipy.optimize import fsolve
from scipy.special import erf

def find_zscore(f):
def inner_function(zscore):
return 1 - f - erf(zscore / np.sqrt(2.0))

return fsolve(inner_function, 3)

value_m = self.data_structure[field]
dates_m = self.data_structure['Datetime']

cleared = False

while not cleared:
value_m = value_m - np.mean(value_m)

value_m = detrend(value_m)

zscore = np.abs(value_m) / np.std(value_m)

number_of_points = value_m.size

f = 1/number_of_points

max_zscore = find_zscore(f)

i = np.where(zscore <= max_zscore)

if len(i[0]) == number_of_points:
cleared = True
else:
value_m = value_m[i]
dates_m = dates_m[i]

_, indexes, _ = np.intersect1d(self.data_structure['Datetime'], dates_m, assume_unique = False, return_indices = True)

self.__apply_filtered_indexes(indexes)

def detrend(self, field):

from scipy.signal import detrend
return_data = self.data_structure[field]
return_data -= np.mean(return_data)
return_data = detrend(return_data)

return return_data

@property
def time(self):
return self.data_structure['Datetime']

@property
def co2_flux(self):
return self.data_structure['co2_flux']


145 changes: 145 additions & 0 deletions EddyParserDevelopment.ipynb

Large diffs are not rendered by default.

601 changes: 601 additions & 0 deletions FootprintAnalysis.ipynb

Large diffs are not rendered by default.

239 changes: 239 additions & 0 deletions GPSDevel.ipynb

Large diffs are not rendered by default.

628 changes: 628 additions & 0 deletions HotCreek.ipynb

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 George Hilley

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
114 changes: 114 additions & 0 deletions LoadAndProcessGPSData.ipynb

Large diffs are not rendered by default.

143 changes: 143 additions & 0 deletions LoadAndProcessRegionalGPSData.ipynb

Large diffs are not rendered by default.

270 changes: 270 additions & 0 deletions MakeAnimations.ipynb

Large diffs are not rendered by default.

240 changes: 240 additions & 0 deletions MakeAnimationsSierras.ipynb

Large diffs are not rendered by default.

254 changes: 254 additions & 0 deletions MakeAnimationsSierrasVertical.ipynb

Large diffs are not rendered by default.

254 changes: 254 additions & 0 deletions MakeAnimationsVertical.ipynb

Large diffs are not rendered by default.

340 changes: 340 additions & 0 deletions NoiseAnalysis.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 4f7fa94

Please sign in to comment.