Skip to content

Commit

Permalink
Merge pull request #22 from csyhuang/develop
Browse files Browse the repository at this point in the history
Release 0.3.7
  • Loading branch information
csyhuang authored Sep 15, 2019
2 parents 884d168 + 331401f commit cb734f4
Show file tree
Hide file tree
Showing 17 changed files with 3,508 additions and 679 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
language: python
python:
- "2.7"
- "3.6"
- "3.4"
- "3.5"
- "3.6" # current default Python on Travis CI
- "3.7"

install:
- pip install --upgrade pip setuptools wheel
Expand All @@ -12,6 +15,6 @@ install:

# command to run tests
script:
- coverage run --source=hn2016_falwa setup.py test
- python setup.py pytest

after_success: pip install codecov && codecov
4 changes: 2 additions & 2 deletions examples/nh2018_science/demo_script_for_nh2018.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"This notebook demonstrate how to compute local wave activity and all the flux terms in equations (2) and (3) in NH2018 with the updated functionality in the python package `hn2016_falwa`. To run the script, please install the \n",
"package `hn2016_falwa` using\n",
"```\n",
"python setup.py install\n",
"python setup.py develop\n",
"```\n",
"after cloning the [GitHub repo](http://github.com/csyhuang/hn2016_falwa).\n",
"\n",
Expand Down Expand Up @@ -503,7 +503,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.5.6"
}
},
"nbformat": 4,
Expand Down
2,808 changes: 2,808 additions & 0 deletions examples/sandy/demo_script_for_sandy_days.ipynb

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion hn2016_falwa/basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def eqvlat(ylat, vort, area, n_points, planet_radius=6.378e+6, vgrad=None):
vort_min = np.min([vort.min(), vort.min()])
vort_max = np.max([vort.max(), vort.max()])
q_part_u = np.linspace(vort_min, vort_max, n_points, endpoint=True)
#dq = q_part_u[2] - q_part_u[1]
aa = np.zeros(q_part_u.size) # to sum up area
vort_flat = vort.flatten() # Flatten the 2D arrays to 1D
area_flat = area.flatten()
Expand Down
1 change: 1 addition & 0 deletions hn2016_falwa/beta_version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
def input_jk_output_index(j,k,kmax):
return j*(kmax) + k


def extrap1d(interpolator):

xs = interpolator.x
Expand Down
7 changes: 7 additions & 0 deletions hn2016_falwa/constant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Define physical constants
P0 = 1000. # Ground pressure level. Unit: hPa
SCALE_HEIGHT = 7000. # Unit: m
CP = 1004. # specific heat at constant pressure for air (cp) = 1004 J/kg-K
DRY_GAS_CONSTANT = 287.
EARTH_RADIUS = 6.378e+6 # Unit: m
EARTH_OMEGA = 7.29e-5
52 changes: 52 additions & 0 deletions hn2016_falwa/download_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env python
from enum import Enum
from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer()


class ERAICode(Enum):
u = '131.128' # zonal wind
v = '132.128' # meridional wind
t = '130.128' # temperature

def retrieve_erai(start_date, end_date, file_suffix, var_list):
"""
Args:
start_date(datetime.date)
start_date(datetime.date)
file_suffix(str)
var_list(list)
Return:
A boolean indicating whether the download is successful
"""

start_date_str = start_date.strftime(format='%Y-%m-%d')
end_date_str = end_date.strftime(format='%Y-%m-%d')
fname = "{}_to_{}_{}.nc".format(start_date_str, end_date_str, file_suffix)
param_str = "/".join([x.value for x in var_list])

try:
server.retrieve({
"class": "ei",
"dataset": "interim",
"date": "{}/to/{}".format(start_date_str, end_date_str),
"expver": "1",
"grid": "1.5/1.5",
"levelist": "1/2/3/5/7/10/20/30/50/70/100/125/150/175/200/225/250/300/350/400/450/500/550/600/650/700/750/775/800/825/850/875/900/925/950/975/1000",
"levtype": "pl",
"param": param_str,
"step": "0",
"stream": "oper",
"format": "netcdf",
"time": "00:00:00/06:00:00/12:00:00/18:00:00",
"type": "an",
"target": fname,
})
print('Finished downloading {}'.format(fname))
return True
except:
print('Failed downloading {}'.format(fname))
return False


Loading

0 comments on commit cb734f4

Please sign in to comment.