-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from csyhuang/develop
Release 0.3.7
- Loading branch information
Showing
17 changed files
with
3,508 additions
and
679 deletions.
There are no files selected for viewing
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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 | ||
|
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
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 |
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
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 | ||
|
||
|
Oops, something went wrong.