Skip to content

Commit

Permalink
version 0.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
donmezkutay committed Nov 14, 2020
1 parent ab09879 commit caccd85
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 989 deletions.
49 changes: 0 additions & 49 deletions Usage_Examples/height_pressure.py

This file was deleted.

1 change: 0 additions & 1 deletion Usage_Examples/relative_vorticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


get_ipython().system('git clone https://github.com/tomerburg/metlib.git')
get_ipython().system('git clone https://github.com/donmezk/visjobs.git ')


#get dependencies
Expand Down
1 change: 0 additions & 1 deletion Usage_Examples/tc_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from visjobs.visualize import easy_plot
import cartopy
from matplotlib.collections import LineCollection
import seaborn as sns
import matplotlib as mpl

#get atlantic best track data from NHC
Expand Down
45 changes: 0 additions & 45 deletions Usage_Examples/temp_rh_cross_aegean.py

This file was deleted.

49 changes: 0 additions & 49 deletions Usage_Examples/wind_gust.py

This file was deleted.

42 changes: 0 additions & 42 deletions Usage_Examples/wind_power_generation.py

This file was deleted.

58 changes: 0 additions & 58 deletions Usage_Examples/wind_pressure_rh.py

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="visjobs", # Replace with your own username
version="0.0.12",
version="0.0.13",
author="Kutay Donmez & Berkay Donmez",
author_email="[email protected]",
description="Get The Latest Atmospheric Model Data | Analyse | Visualize Easily",
Expand Down
44 changes: 18 additions & 26 deletions visjobs/datas/get_MODEL.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ def pick_data(year=None, month=None, day=None, hour=None, latest=False, model='G
#GEFS
elif model == models[2]:

data = xr.open_dataset(r'http://nomads.ncep.noaa.gov:80/dods/gens_bc/gens{}/gep_all_{}z'.
data = xr.open_dataset(r'http://nomads.ncep.noaa.gov:80/dods/gefs/gefs{}/gefs_pgrb2bp5_all_{}z'.
format(str(year)+str(month)+str(day), hour),
*args, **kwargs)
print('Addressing Data: ', 'http://nomads.ncep.noaa.gov:80/dods/gens_bc/gens{}/gep_all_{}z'.
print('Addressing Data: ', 'http://nomads.ncep.noaa.gov:80/dods/gefs/gefs{}/gefs_pgrb2bp5_all_{}z'.
format(str(year)+str(month)+str(day), hour) )

#HRRR
Expand Down Expand Up @@ -188,18 +188,21 @@ def pick_area(data ,total_process, interval ,list_of_vars, list_of_areas, init_t
total_process :int; means the until which time step data is expected (1 or 2 or 100 etc.)
interval :int; means until the expected time step in which interval data should be taken.
list_of_vars :list of str; (Data variable names) the list of variables can be also a single element list:
['tmp2m'] or ['tmp2m', 'hgtprs'] etc.
list_of_areas :list of str; the list of areas can be also a single element:
available options:
['europe','northamerica','australia','gulfofmexico','carribeans','indianocean']
pr_height :If the desired data is in pressure levels, which levels are expected? List of Pressure Levels:
['500'] or ['1000', '850', '500'] etc.
"""



#trying if the longitude values change from 0 to 360 or -180 to 180?

if data['tmp2m']['lon'].values[0] < 0:
if data['lon'].values[0] < 0:

p_d = {'europe' : [0, 48, 30, 65],
'northamerica' : [-142,-42,0,60],
Expand Down Expand Up @@ -232,34 +235,23 @@ def pick_area(data ,total_process, interval ,list_of_vars, list_of_areas, init_t
for var in list_of_vars:
#check if data contains 'lev' coords.
try:
if len(pr_height) == 1:
#wrap the data
single = data[var][init_time:total_process:interval, :, :].sel(lon=slice(p_d[pl][0],p_d[pl][1]),
lat=slice(p_d[pl][2],p_d[pl][3]),
lev=pr_height[0])
elif len(pr_height) == 2:
single = data[var][init_time:total_process:interval, :, :].sel(lon=slice(p_d[pl][0],p_d[pl][1]),
lat=slice(p_d[pl][2],p_d[pl][3]),
lev=slice(pr_height[0],pr_height[1]))
#append a single variable given by the user

#wrap the data
single = data[var].sel(lon=slice(p_d[pl][0],p_d[pl][1]),
lat=slice(p_d[pl][2],p_d[pl][3]),
lev=pr_height).isel(time=slice(init_time, total_process, interval))


#if no 'lev' coords exist.
except:
single = data[var][init_time:total_process:interval, :, :].sel(lon=slice(p_d[pl][0],p_d[pl][1]),
lat=slice(p_d[pl][2],p_d[pl][3]),)
single = data[var].sel(lon=slice(p_d[pl][0],p_d[pl][1]),
lat=slice(p_d[pl][2],p_d[pl][3]),).isel(time=slice(init_time, total_process, interval))

#append a single variable given by the user
variables_l.append(single)





#append all the variables with respect to their area of interest.
places_dict[pl] = variables_l

#time data with interval
time_w_interval = data['time'][init_time:total_process:interval]
places_dict[pl] = variables_l[0]

#return
return len(time_w_interval), places_dict
return places_dict
Loading

0 comments on commit caccd85

Please sign in to comment.