-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upload of HWMI and HWs_detection packages
HWMI.py was already needed for Calc-HWMI.ipynb script. HWs_detection.py and Detect_HWs_script.ipynb working versions.
- Loading branch information
Showing
3 changed files
with
927 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,312 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib\n", | ||
"#matplotlib.use('Agg')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"import datetime\n", | ||
"import time\n", | ||
"import copy\n", | ||
"import shutil\n", | ||
"import sys\n", | ||
"sys.path.append('/cnrm/pastel/USERS/lecestres/analyse/')\n", | ||
"from function_read import *\n", | ||
"from HWs_detection import *\n", | ||
"import numpy as np\n", | ||
"from mpl_toolkits.axes_grid1 import make_axes_locatable\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"from mpl_toolkits.basemap import Basemap, shiftgrid\n", | ||
"\n", | ||
"import calendar\n", | ||
"import locale\n", | ||
"locale.setlocale( locale.LC_ALL , 'en_US' )\n", | ||
"from netCDF4 import num2date, date2num \n", | ||
"import netCDF4\n", | ||
"from math import sin, cos, sqrt, atan2, radians\n", | ||
"from sklearn.neighbors import DistanceMetric\n", | ||
"from math import radians\n", | ||
"\n", | ||
"from joblib import Parallel, delayed\n", | ||
"import joblib" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"### EXPERIENCE NAME\n", | ||
"expname = \"ocean_reanalysis_GREP\"\n", | ||
"#expname = \"sst_retroprevision_sys7\"\n", | ||
"\n", | ||
"### PERCENTILE THRESHOLD\n", | ||
"percent_thresh = 95\n", | ||
"#percent_thresh = 90\n", | ||
"\n", | ||
"### MINIMAL DURATION OF A HW\n", | ||
"duration_min = 5\n", | ||
"#duration_min = 3\n", | ||
"\n", | ||
"### REGION OF EXPERIENCE\n", | ||
"reg_name = \"global\"\n", | ||
"#reg_name = 'lat30_70-lon-40_0'\n", | ||
"#reg_name = 'lat-20_30-lon-30_10'\n", | ||
"if reg_name == 'global':\n", | ||
" lats_bnds = [-90,90]\n", | ||
" lons_bnds = [-180,180] \n", | ||
"elif reg_name == 'lat30_70-lon-40_0':\n", | ||
" lats_bnds = [30,70]\n", | ||
" lons_bnds = [-40, 0]\n", | ||
"elif reg_name == 'lat-20_30-lon-30_10':\n", | ||
" lats_bnds = [-20, 20]\n", | ||
" lons_bnds = [-30, 10]\n", | ||
"nlat = lats_bnds[1]-lats_bnds[0]\n", | ||
"nlon = lons_bnds[1]-lons_bnds[0]\n", | ||
"\n", | ||
"### YEARS\n", | ||
"if expname == 'ocean_reanalysis_GREP':\n", | ||
" end_year=2018\n", | ||
" start_year=1993\n", | ||
"elif expname == 'sst_retroprevision_sys7':\n", | ||
" end_year=2016\n", | ||
" start_year=1993\n", | ||
"nyear=end_year-start_year+1\n", | ||
"\n", | ||
"### SEASON\n", | ||
"season = \"NDJFMAM\"\n", | ||
"if season == 'NDJFMAM':\n", | ||
" nday = 211\n", | ||
" season_start_day = [11,1] #1stNov\n", | ||
" season_end_day = [5,31] #31stMay\n", | ||
"elif season == 'DJF':\n", | ||
" nday = 90\n", | ||
"ndayseas = nday//duration_min +1\n", | ||
"\n", | ||
"if expname == \"ocean_reanalysis_GREP\": \n", | ||
" ### NUMBER OF MEMBS\n", | ||
" nmemb = 1\n", | ||
" chosen_memb = [0] #should never change\n", | ||
" memb_str = 'memb' + str(chosen_memb[0])\n", | ||
" \n", | ||
" ### CROSS VALIDATION\n", | ||
" cv = False\n", | ||
" if cv:\n", | ||
" cv_str = \"CV\"\n", | ||
" else:\n", | ||
" cv_str = 'notCV'\n", | ||
" \n", | ||
"elif expname == \"sst_retroprevision_sys7\": \n", | ||
" ### NUMBER OF MEMBS\n", | ||
" nmemb = 1 #For now keep just one memb by one\n", | ||
" chosen_memb = [21] #to be filled in numerical order\n", | ||
" if len(chosen_memb) != nmemb:\n", | ||
" raise(ValueError)\n", | ||
" if nmemb>1:\n", | ||
" memb_str = 'memb' + str(chosen_memb[0]) + '-' + str(chosen_memb[-1])\n", | ||
" else:\n", | ||
" memb_str = 'memb' + str(chosen_memb[0])\n", | ||
" \n", | ||
" ### CROSS VALIDATION\n", | ||
" cv = True\n", | ||
" if cv:\n", | ||
" cv_str = \"CV\"\n", | ||
" else:\n", | ||
" cv_str = 'notCV'\n", | ||
"\n", | ||
"### PARAMETERS\n", | ||
"parameters_str = reg_name + \"_\" + season + \"_\" + cv_str + '_percent%i'%(percent_thresh) + '_daymin%i'%(duration_min) + \"ref%i-%i\"%(start_year, end_year) + '_' + memb_str\n", | ||
"\n", | ||
"### NAME OF THE VARIABLES IN THE NC FILES\n", | ||
"#varname = 'HWMI_' + parameters_str\n", | ||
"varname = 'subHW_' + parameters_str" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"pathHWMI = '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/' + expname + '/' + memb_str + '/' + varname + '/'\n", | ||
"files = glob(pathHWMI + '*.nc')\n", | ||
"files.sort()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"['/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_1993_1994.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_1994_1995.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_1995_1996.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_1996_1997.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_1997_1998.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_1998_1999.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_1999_2000.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2000_2001.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2001_2002.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2002_2003.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2003_2004.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2004_2005.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2005_2006.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2006_2007.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2007_2008.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2008_2009.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2009_2010.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2010_2011.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2011_2012.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2012_2013.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2013_2014.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2014_2015.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2015_2016.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2016_2017.nc',\n", | ||
" '/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/HWMI_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_2017_2018.nc']" | ||
] | ||
}, | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"files" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n", | ||
"varf.variables[varname].shape : (1, 1, 180, 360)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"obsregyearslst = []\n", | ||
"for file in files:\n", | ||
" varf=netCDF4.Dataset(file)\n", | ||
" varf.variables[varname]\n", | ||
" vararray, lats_reg, lons_reg = extract_array(varf, varname, ndayseas, np.array(lons_bnds), np.array(lats_bnds), start_time = 0, level=0)\n", | ||
" obsreg = vararray[:, np.newaxis, :, :]\n", | ||
" maskobs = obsreg.mask\n", | ||
" obsregyearslst.append(obsreg)\n", | ||
"\n", | ||
"obsregyears = np.ma.array(obsregyearslst)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"0\n", | ||
"(array([0, 0, 0, ..., 0, 0, 0]), array([ 13, 13, 13, ..., 175, 175, 175]), array([ 0, 1, 2, ..., 218, 219, 220]))\n", | ||
"/cnrm/pastel/USERS/lecestres/NO_SAVE/data/ocean_reanalysis_GREP/memb0/Ampli_Fields_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0/Ampli_Fields_global_NDJFMAM_notCV_percent95_daymin5ref1993-2018_memb0_1993_1994.nc\n", | ||
"ndayseas : 1\n", | ||
"(434, 1)\n", | ||
"(434, 1)\n", | ||
"time for year 1993 : 3.8596889972686768\n", | ||
"(array([0, 0, 0, ..., 0, 0, 0]), array([ 13, 13, 13, ..., 174, 174, 174]), array([ 0, 1, 2, ..., 230, 231, 232]))\n" | ||
] | ||
}, | ||
{ | ||
"ename": "KeyboardInterrupt", | ||
"evalue": "", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | ||
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", | ||
"\u001b[0;32m<ipython-input-7-396eb839f4a7>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mstart_time\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mexpname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreg_name\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmemb_str\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparameters_str\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstart_year\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlats_reg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlons_reg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mHWampliobsmembyear\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mHWstartobsmembyear\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mHWendobsmembyear\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfieldobslstmembyear\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcalc_HW_MY\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mobsregyears\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmaskobs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlats_reg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlons_reg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mallowdist\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Total time for detection : '\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0mstart_time\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | ||
"\u001b[0;32m/mnt/nfs/d50/pastel/USERS/lecestres/analyse/HWs_detection.py\u001b[0m in \u001b[0;36mcalc_HW_MY\u001b[0;34m(mod, mask, lat, lon, args, allowdist)\u001b[0m\n\u001b[1;32m 271\u001b[0m \u001b[0;31m#print(lat)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 272\u001b[0m \u001b[0;31m#print(lon)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 273\u001b[0;31m \u001b[0mHW\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdetectHW1year\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfield\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlat\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlon\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mallowdist\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 274\u001b[0m \u001b[0;31m#print('HW list :', HW)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 275\u001b[0m \u001b[0mstart_time_i\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | ||
"\u001b[0;32m/mnt/nfs/d50/pastel/USERS/lecestres/analyse/HWs_detection.py\u001b[0m in \u001b[0;36mdetectHW1year\u001b[0;34m(field, lat, lon, args, allowdist)\u001b[0m\n\u001b[1;32m 84\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mnei\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mlistnei\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 85\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnei\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mptHWlst\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m#Not interested if neighbour has already been looked for\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 86\u001b[0;31m \u001b[0;32mif\u001b[0m \u001b[0mnei\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mHWpointaux\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m#if neighbour point is indeed part of the HW\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 87\u001b[0m \u001b[0;31m#add the neighbourg to the seedlist\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 88\u001b[0m \u001b[0mseedlist\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnei\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | ||
"\u001b[0;31mKeyboardInterrupt\u001b[0m: " | ||
] | ||
} | ||
], | ||
"source": [ | ||
"start_time = time.time()\n", | ||
"args = (expname, reg_name, memb_str, parameters_str, start_year, lats_reg, lons_reg)\n", | ||
"HWampliobsmembyear, HWstartobsmembyear, HWendobsmembyear, fieldobslstmembyear = calc_HW_MY(obsregyears, maskobs, lats_reg, lons_reg, args, allowdist=1)\n", | ||
"print('Total time for detection : ', time.time() - start_time)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.