-
Notifications
You must be signed in to change notification settings - Fork 27
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 #35 from djgagne/djgagne
Environment.yml and other compatibility updates
- Loading branch information
Showing
49 changed files
with
185 additions
and
186 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
language: python | ||
env: | ||
- PYTHON_VERSION=2.7 IPYTHON_KERNEL=python2 | ||
- PYTHON_VERSION=3.6 IPYTHON_KERNEL=python3 | ||
- PYTHON_VERSION=3.7 IPYTHON_KERNEL=python3 | ||
|
||
- PYTHON_VERSION=3.8 IPYTHON_KERNEL=python3 | ||
before_install: | ||
- wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh | ||
- sh Miniconda3-latest-Linux-x86_64.sh -b -p /home/travis/miniconda | ||
- export PATH=/home/travis/miniconda/bin:$PATH | ||
install: | ||
- conda create -n testenv --yes -c conda-forge python=$PYTHON_VERSION pip numpy scipy matplotlib | ||
- source activate testenv | ||
- conda install --yes -c conda-forge pygrib scikit-learn scikit-image netcdf4 basemap | ||
- pip install arrow | ||
- pip install pytest | ||
- pip install . | ||
- conda env create --yes -f environment.yml | ||
- source activate hagelslag | ||
script: | ||
- py.test | ||
- pytest | ||
notifications: | ||
email: true | ||
email: true |
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
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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/usr/bin/env python | ||
from hagelslag.processing.ObjectMatcher import shifted_centroid_distance,closest_distance | ||
from hagelslag.processing.ObjectMatcher import centroid_distance, time_distance | ||
|
||
import pandas as pd | ||
import numpy as np | ||
import os, sys | ||
from datetime import datetime | ||
|
||
work_path = "/glade/work/dgagne/NSC_data/" | ||
scratch_path = "/glade/scratch/dgagne/" | ||
dates = pd.read_csv("/glade/u/home/dgagne/hagelslag/config/ncar_storm_dates_3km_new.txt", | ||
header=None)[0].astype(str).str.pad(14, side="right",fillchar="0") | ||
date_index = pd.DatetimeIndex(dates) | ||
ensemble_members = ["d01"] | ||
pressure_levels = ["850", "700", "500", "300"] | ||
pres_vars = ["GHT_PL", "T_PL", "TD_PL", "U_PL", "V_PL"] | ||
full_pres_vars = [] | ||
for pres_var in pres_vars: | ||
for pressure_level in pressure_levels: | ||
full_pres_vars.append(pres_var + "_" + pressure_level) | ||
REFL_1KM_AGL = { | ||
"name": "REFL_1KM_AGL", | ||
"params": (30, 1, 80, 300, 60), | ||
"object_matcher_params":([shifted_centroid_distance],np.array([1.0]),np.array([24000])) | ||
} | ||
W_UP_MAX = { | ||
"name": "W_UP_MAX", | ||
"params": (10, 1, 80, 300, 60), | ||
"object_matcher_params":([closest_distance,shifted_centroid_distance],np.array([0.9,0.1]),np.array([1,24000])) | ||
} | ||
REFL_COM = { | ||
"name": "REFL_COM", | ||
"params": (40, 1, 80, 300, 50), | ||
"object_matcher_params":([shifted_centroid_distance],np.array([1.0]),np.array([24000])) | ||
} | ||
segmentation_approach = "hyst" # "hyst", "ws", or "ew" | ||
REFL_COM["params"] = (35, 50) | ||
watershed_dict = REFL_COM | ||
watershed_variable = watershed_dict["name"] | ||
output_prefix = work_path + "track_data_nsc_3km_"+watershed_variable+"_"+segmentation_approach | ||
config = dict(dates=date_index.to_pydatetime(), | ||
start_hour=1, | ||
end_hour=35, # Don't go above maximum lead time-1 (35) or diagnostics file for storm_variables won't be found | ||
watershed_variable=watershed_variable, | ||
ensemble_name="NCARSTORM", | ||
ensemble_members=ensemble_members, | ||
model_path="/glade/p/mmm/parc/sobash/NSC/3KM_WRF_POST_12sec_ts/", | ||
segmentation_approach = segmentation_approach, | ||
model_watershed_params=watershed_dict["params"], | ||
size_filter=12, | ||
gaussian_window=0, | ||
#mrms_path= work_path + "mrms_ncar/", | ||
mrms_path=None, | ||
mrms_variable="MESH_Max_60min_00.50", | ||
mrms_watershed_params=(13, 1, 125, 100, 100), | ||
object_matcher_params=watershed_dict["object_matcher_params"], | ||
track_matcher_params=([centroid_distance, time_distance], | ||
np.array([80000, 2])), | ||
storm_variables=["UP_HELI_MAX", "GRPL_MAX", "WSPD10MAX", "W_UP_MAX", "W_DN_MAX", | ||
"RVORT1_MAX", "RVORT5_MAX", "UP_HELI_MAX03", "UP_HELI_MAX01", | ||
"UP_HELI_MIN", "REFL_COM", "REFL_1KM_AGL", "REFD_MAX", | ||
"PSFC", "T2", "Q2", "TD2", "U10", "V10"] + full_pres_vars, | ||
#"UP_HELI_MIN", "HAIL_MAXK1", "HAIL_MAX2D", "HAILCAST_DIAM_MAX", | ||
potential_variables=["SBLCL", "MLLCL", "SBCAPE", "MLCAPE", "MUCAPE", "SBCINH", "MLCINH", | ||
"USHR1", "VSHR1", "USHR6", "VSHR6", "U_BUNK", "V_BUNK", | ||
"SRH03", "SRH01", "PSFC", "T2", "Q2", "TD2", "U10", "V10"], | ||
#"PSFC", "T2", "Q2", "TD2", "U10", "V10"] + full_pres_vars, | ||
future_variables=["REFL_COM", "UP_HELI_MAX", "GRPL_MAX", "HAIL_MAXK1", "UP_HELI_MAX03"], | ||
tendency_variables=[], | ||
shape_variables=["area", "eccentricity", "major_axis_length", "minor_axis_length", "orientation"], | ||
#variable_statistics=["mean", "max", "min", "std", | ||
# "percentile_10", "percentile_25", "percentile_50", "percentile_75", "percentile_90"], | ||
variable_statistics=["mean", "max", "min"], | ||
csv_path = output_prefix + "_csv/", | ||
geojson_path = output_prefix + "_json/", | ||
nc_path = output_prefix + "_nc/", | ||
patch_radius=40, | ||
unique_matches=True, | ||
closest_matches=True, | ||
match_steps=True, | ||
train=False, | ||
single_step=True, | ||
label_type="gamma", | ||
model_map_file="/glade/u/home/dgagne/hagelslag/mapfiles/ncar_storm_map_3km.txt", | ||
mask_file="/glade/u/home/dgagne/hagelslag/mapfiles/ncar_storm_us_mask_3km.nc") | ||
if not os.path.exists(config["csv_path"]): | ||
print("csv_path doesn't exist. Try mkdir",config["csv_path"]) | ||
sys.exit(1) | ||
if not os.path.exists(config["nc_path"]): | ||
print("nc_path doesn't exist. Try mkdir",config["nc_path"]) | ||
sys.exit(1) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ Subpackages | |
|
||
hagelslag.data | ||
hagelslag.evaluation | ||
hagelslag.plot | ||
hagelslag.processing | ||
hagelslag.util | ||
|
||
|
Oops, something went wrong.