Skip to content

Commit 9774b83

Browse files
tidal monthly simus
1 parent 23df61b commit 9774b83

24 files changed

Lines changed: 1210 additions & 0 deletions
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Modules
2+
from parcels import FieldSet, ParticleSet, JITParticle, AdvectionRK4, ErrorCode
3+
from datetime import timedelta, datetime
4+
from glob import glob
5+
import xarray as xr
6+
import numpy as np
7+
8+
# Defining functions
9+
10+
def DeleteParticle(particle, fieldset, time):
11+
particle.delete()
12+
13+
# Parameters:
14+
15+
#Particle_AZO_grid100000_notides_Dec_week01_hourly.nc
16+
tide_name = "tides"
17+
nmonth = 4
18+
simu_length = 28. # monthly # days
19+
20+
# Defining grid of starting particles:
21+
22+
step = .04 # degrees
23+
lons, lats = np.meshgrid(np.arange(-35, -18+step, step), np.arange(30, 40+step, step))
24+
lons.shape[0]*lons.shape[1]
25+
26+
#
27+
28+
if tide_name == "no_tides":
29+
tide_nameF = "BLB002"
30+
tide_out = "ntides"
31+
elif tide_name == "tides":
32+
tide_nameF = "BLBT02"
33+
tide_out = "wtides"
34+
else:
35+
print("Error")
36+
dsgsdgs
37+
38+
if nmonth > 6:
39+
nyear = 2009
40+
41+
elif nmonth <= 6:
42+
nyear = 2010
43+
else:
44+
print('error')
45+
fsdgsdgg
46+
47+
data_path = '/data/oceanparcels/input_data/eNATL60/Azores/'
48+
49+
ufiles = sorted(glob(data_path + 'UV/' + tide_name + '/eNATL60ACOl-' + tide_nameF + '_y' + str(nyear) + 'm' + str(nmonth).zfill(2) + 'd*.1h_sozocrtx.nc'))
50+
vfiles = sorted(glob(data_path + 'UV/' + tide_name + '/eNATL60ACOl-' + tide_nameF + '_y' + str(nyear) + 'm' + str(nmonth).zfill(2) + 'd*.1h_somecrty.nc'))
51+
52+
variables = {'U': 'sozocrtx', 'V': 'somecrty'}
53+
54+
mesh_mask = data_path + 'coordinates_eNATL60ACOl.nc'
55+
56+
filenames = {'U': {'lon': mesh_mask, 'lat': mesh_mask, 'data': ufiles},
57+
'V': {'lon': mesh_mask, 'lat': mesh_mask, 'data': vfiles}}
58+
59+
dimensions = {'U': {'lon': 'glamf', 'lat': 'gphif', 'time': 'time_counter'},
60+
'V': {'lon': 'glamf', 'lat': 'gphif', 'time': 'time_counter'}}
61+
62+
fieldset_AZO = FieldSet.from_nemo(filenames, variables, dimensions)
63+
64+
#
65+
66+
ds_mesh = xr.open_dataset(mesh_mask)
67+
68+
outdir_root = "/scratch/gomez023/outputs_parcels/"
69+
outdir = outdir_root + tide_out + "/monthly/"
70+
71+
# Define start date:
72+
start_days = [1] #[1, 8, 15, 22]
73+
74+
for start_day in start_days:
75+
76+
outname = outdir + "Particle_AZO_grid100000p_" + tide_out + "_" + str(nmonth).zfill(2) + str(start_day).zfill(2) + "_hourly_MONTH"
77+
pset_AZO_grid = ParticleSet(fieldset=fieldset_AZO, pclass=JITParticle, lon=lons, lat=lats, time=datetime(nyear, nmonth, start_day, 0, 30))
78+
output_file = pset_AZO_grid.ParticleFile(name=outname, outputdt=timedelta(hours=1))
79+
pset_AZO_grid.execute(AdvectionRK4, runtime=timedelta(days=simu_length), dt=timedelta(minutes=5),
80+
recovery={ErrorCode.ErrorOutOfBounds: DeleteParticle}, output_file=output_file)
81+
output_file.export() # export the trajectory data to a netcdf file
82+
83+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#/bin/sh
2+
3+
# SGE: the job name
4+
#$ -N Azores_eNATL60_wtide_Apr_MONTHLY
5+
#
6+
# The requested run-time, expressed as (xxxx sec or hh:mm:ss)
7+
#$ -l h_rt=02:00:00
8+
#
9+
# SGE: your Email here, for job notification
10+
#$ -M l.gomeznavarro@uu.nl
11+
#
12+
# SGE: when do you want to be notified (b : begin, e : end, s : error)?
13+
#$ -m es
14+
#
15+
# SGE: output in the current working dir
16+
#$ -cwd
17+
#
18+
cd /nethome/gomez023/parcels_Azores/wtides/monthly/
19+
python3 parcels_azores_eNATL60_wtide_Apr_monthly.py
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Modules
2+
from parcels import FieldSet, ParticleSet, JITParticle, AdvectionRK4, ErrorCode
3+
from datetime import timedelta, datetime
4+
from glob import glob
5+
import xarray as xr
6+
import numpy as np
7+
8+
# Defining functions
9+
10+
def DeleteParticle(particle, fieldset, time):
11+
particle.delete()
12+
13+
# Parameters:
14+
15+
# TO DOOO
16+
#Particle_AZO_grid100000_notides_Dec_week01_hourly.nc
17+
tide_name = "tides"
18+
nmonth = 8
19+
simu_length = 28. # monthly # days
20+
21+
# Defining grid of starting particles:
22+
23+
step = .04 # degrees
24+
lons, lats = np.meshgrid(np.arange(-35, -18+step, step), np.arange(30, 40+step, step))
25+
lons.shape[0]*lons.shape[1]
26+
27+
#
28+
29+
if tide_name == "no_tides":
30+
tide_nameF = "BLB002"
31+
tide_out = "ntides"
32+
elif tide_name == "tides":
33+
tide_nameF = "BLBT02"
34+
tide_out = "wtides"
35+
else:
36+
print("Error")
37+
dsgsdgs
38+
39+
if nmonth > 6:
40+
nyear = 2009
41+
42+
elif nmonth <= 6:
43+
nyear = 2010
44+
else:
45+
print('error')
46+
fsdgsdgg
47+
48+
data_path = '/data/oceanparcels/input_data/eNATL60/Azores/'
49+
50+
ufiles = sorted(glob(data_path + 'UV/' + tide_name + '/eNATL60ACOl-' + tide_nameF + '_y' + str(nyear) + 'm' + str(nmonth).zfill(2) + 'd*.1h_sozocrtx.nc'))
51+
vfiles = sorted(glob(data_path + 'UV/' + tide_name + '/eNATL60ACOl-' + tide_nameF + '_y' + str(nyear) + 'm' + str(nmonth).zfill(2) + 'd*.1h_somecrty.nc'))
52+
53+
variables = {'U': 'sozocrtx', 'V': 'somecrty'}
54+
55+
mesh_mask = data_path + 'coordinates_eNATL60ACOl.nc'
56+
57+
filenames = {'U': {'lon': mesh_mask, 'lat': mesh_mask, 'data': ufiles},
58+
'V': {'lon': mesh_mask, 'lat': mesh_mask, 'data': vfiles}}
59+
60+
dimensions = {'U': {'lon': 'glamf', 'lat': 'gphif', 'time': 'time_counter'},
61+
'V': {'lon': 'glamf', 'lat': 'gphif', 'time': 'time_counter'}}
62+
63+
fieldset_AZO = FieldSet.from_nemo(filenames, variables, dimensions)
64+
65+
#
66+
67+
ds_mesh = xr.open_dataset(mesh_mask)
68+
69+
outdir_root = "/scratch/gomez023/outputs_parcels/"
70+
outdir = outdir_root + tide_out + "/monthly/"
71+
72+
# Define start date:
73+
start_days = [1] #[1, 8, 15, 22]
74+
75+
for start_day in start_days:
76+
77+
outname = outdir + "Particle_AZO_grid100000p_" + tide_out + "_" + str(nmonth).zfill(2) + str(start_day).zfill(2) + "_hourly_MONTH"
78+
pset_AZO_grid = ParticleSet(fieldset=fieldset_AZO, pclass=JITParticle, lon=lons, lat=lats, time=datetime(nyear, nmonth, start_day, 0, 30))
79+
output_file = pset_AZO_grid.ParticleFile(name=outname, outputdt=timedelta(hours=1))
80+
pset_AZO_grid.execute(AdvectionRK4, runtime=timedelta(days=simu_length), dt=timedelta(minutes=5),
81+
recovery={ErrorCode.ErrorOutOfBounds: DeleteParticle}, output_file=output_file)
82+
output_file.export() # export the trajectory data to a netcdf file
83+
84+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#/bin/sh
2+
3+
# SGE: the job name
4+
#$ -N Azores_eNATL60_wtide_August_MONTHLY
5+
#
6+
# The requested run-time, expressed as (xxxx sec or hh:mm:ss)
7+
#$ -l h_rt=02:00:00
8+
#
9+
# SGE: your Email here, for job notification
10+
#$ -M l.gomeznavarro@uu.nl
11+
#
12+
# SGE: when do you want to be notified (b : begin, e : end, s : error)?
13+
#$ -m es
14+
#
15+
# SGE: output in the current working dir
16+
#$ -cwd
17+
#
18+
cd /nethome/gomez023/parcels_Azores/wtides/monthly/
19+
python3 parcels_azores_eNATL60_wtide_Aug_monthly.py
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Modules
2+
from parcels import FieldSet, ParticleSet, JITParticle, AdvectionRK4, ErrorCode
3+
from datetime import timedelta, datetime
4+
from glob import glob
5+
import xarray as xr
6+
import numpy as np
7+
8+
# Defining functions
9+
10+
def DeleteParticle(particle, fieldset, time):
11+
particle.delete()
12+
13+
# Parameters:
14+
15+
# TO DOOO
16+
#Particle_AZO_grid100000_notides_Dec_week01_hourly.nc
17+
tide_name = "tides"
18+
nmonth = 12
19+
simu_length = 28. # monthly # days
20+
21+
# Defining grid of starting particles:
22+
23+
step = .04 # degrees
24+
lons, lats = np.meshgrid(np.arange(-35, -18+step, step), np.arange(30, 40+step, step))
25+
lons.shape[0]*lons.shape[1]
26+
27+
#
28+
29+
if tide_name == "no_tides":
30+
tide_nameF = "BLB002"
31+
tide_out = "ntides"
32+
elif tide_name == "tides":
33+
tide_nameF = "BLBT02"
34+
tide_out = "wtides"
35+
else:
36+
print("Error")
37+
dsgsdgs
38+
39+
data_path = '/data/oceanparcels/input_data/eNATL60/Azores/'
40+
41+
ufiles = sorted(glob(data_path + 'UV/' + tide_name + '/eNATL60ACOl-' + tide_nameF + '_y2009m12d*.1h_sozocrtx.nc'))
42+
vfiles = sorted(glob(data_path + 'UV/' + tide_name + '/eNATL60ACOl-' + tide_nameF + '_y2009m12d*.1h_somecrty.nc'))
43+
44+
variables = {'U': 'sozocrtx', 'V': 'somecrty'}
45+
46+
mesh_mask = data_path + 'coordinates_eNATL60ACOl.nc'
47+
48+
filenames = {'U': {'lon': mesh_mask, 'lat': mesh_mask, 'data': ufiles},
49+
'V': {'lon': mesh_mask, 'lat': mesh_mask, 'data': vfiles}}
50+
51+
dimensions = {'U': {'lon': 'glamf', 'lat': 'gphif', 'time': 'time_counter'},
52+
'V': {'lon': 'glamf', 'lat': 'gphif', 'time': 'time_counter'}}
53+
54+
fieldset_AZO = FieldSet.from_nemo(filenames, variables, dimensions)
55+
56+
#
57+
58+
ds_mesh = xr.open_dataset(mesh_mask)
59+
60+
outdir_root = "/scratch/gomez023/outputs_parcels/"
61+
outdir = outdir_root + tide_out + "/monthly/"
62+
63+
# Define start date:
64+
start_days = [1] #[1, 8, 15, 22]
65+
66+
for start_day in start_days:
67+
68+
outname = outdir + "Particle_AZO_grid100000p_" + tide_out + "_" + str(nmonth).zfill(2) + str(start_day).zfill(2) + "_hourly_MONTH"
69+
pset_AZO_grid = ParticleSet(fieldset=fieldset_AZO, pclass=JITParticle, lon=lons, lat=lats, time=datetime(2009, nmonth, start_day, 0, 30))
70+
output_file = pset_AZO_grid.ParticleFile(name=outname, outputdt=timedelta(hours=1))
71+
pset_AZO_grid.execute(AdvectionRK4, runtime=timedelta(days=simu_length), dt=timedelta(minutes=5),
72+
recovery={ErrorCode.ErrorOutOfBounds: DeleteParticle}, output_file=output_file)
73+
output_file.export() # export the trajectory data to a netcdf file
74+
75+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#/bin/sh
2+
3+
# SGE: the job name
4+
#$ -N Azores_eNATL60_wtide_December_MONTHLY
5+
#
6+
# The requested run-time, expressed as (xxxx sec or hh:mm:ss)
7+
#$ -l h_rt=02:00:00
8+
#
9+
# SGE: your Email here, for job notification
10+
#$ -M l.gomeznavarro@uu.nl
11+
#
12+
# SGE: when do you want to be notified (b : begin, e : end, s : error)?
13+
#$ -m es
14+
#
15+
# SGE: output in the current working dir
16+
#$ -cwd
17+
#
18+
cd /nethome/gomez023/parcels_Azores/monthly/
19+
python3 parcels_azores_eNATL60_wtide_Dec_monthly.py
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Modules
2+
from parcels import FieldSet, ParticleSet, JITParticle, AdvectionRK4, ErrorCode
3+
from datetime import timedelta, datetime
4+
from glob import glob
5+
import xarray as xr
6+
import numpy as np
7+
8+
# Defining functions
9+
10+
def DeleteParticle(particle, fieldset, time):
11+
particle.delete()
12+
13+
# Parameters:
14+
15+
# TO DOOO
16+
#Particle_AZO_grid100000_notides_Dec_week01_hourly.nc
17+
tide_name = "tides"
18+
nmonth = 2
19+
simu_length = 27. # monthly # days
20+
21+
# Defining grid of starting particles:
22+
23+
step = .04 # degrees
24+
lons, lats = np.meshgrid(np.arange(-35, -18+step, step), np.arange(30, 40+step, step))
25+
lons.shape[0]*lons.shape[1]
26+
27+
#
28+
29+
if tide_name == "no_tides":
30+
tide_nameF = "BLB002"
31+
tide_out = "ntides"
32+
elif tide_name == "tides":
33+
tide_nameF = "BLBT02"
34+
tide_out = "wtides"
35+
else:
36+
print("Error")
37+
dsgsdgs
38+
39+
if nmonth > 6:
40+
nyear = 2009
41+
42+
elif nmonth <= 6:
43+
nyear = 2010
44+
else:
45+
print('error')
46+
fsdgsdgg
47+
48+
data_path = '/data/oceanparcels/input_data/eNATL60/Azores/'
49+
50+
ufiles = sorted(glob(data_path + 'UV/' + tide_name + '/eNATL60ACOl-' + tide_nameF + '_y' + str(nyear) + 'm' + str(nmonth).zfill(2) + 'd*.1h_sozocrtx.nc'))
51+
vfiles = sorted(glob(data_path + 'UV/' + tide_name + '/eNATL60ACOl-' + tide_nameF + '_y' + str(nyear) + 'm' + str(nmonth).zfill(2) + 'd*.1h_somecrty.nc'))
52+
53+
variables = {'U': 'sozocrtx', 'V': 'somecrty'}
54+
55+
mesh_mask = data_path + 'coordinates_eNATL60ACOl.nc'
56+
57+
filenames = {'U': {'lon': mesh_mask, 'lat': mesh_mask, 'data': ufiles},
58+
'V': {'lon': mesh_mask, 'lat': mesh_mask, 'data': vfiles}}
59+
60+
dimensions = {'U': {'lon': 'glamf', 'lat': 'gphif', 'time': 'time_counter'},
61+
'V': {'lon': 'glamf', 'lat': 'gphif', 'time': 'time_counter'}}
62+
63+
fieldset_AZO = FieldSet.from_nemo(filenames, variables, dimensions)
64+
65+
#
66+
67+
ds_mesh = xr.open_dataset(mesh_mask)
68+
69+
outdir_root = "/scratch/gomez023/outputs_parcels/"
70+
outdir = outdir_root + tide_out + "/monthly/"
71+
72+
# Define start date:
73+
start_days = [1] #[1, 8, 15, 22]
74+
75+
for start_day in start_days:
76+
77+
outname = outdir + "Particle_AZO_grid100000p_" + tide_out + "_" + str(nmonth).zfill(2) + str(start_day).zfill(2) + "_hourly_MONTH"
78+
pset_AZO_grid = ParticleSet(fieldset=fieldset_AZO, pclass=JITParticle, lon=lons, lat=lats, time=datetime(nyear, nmonth, start_day, 0, 30))
79+
output_file = pset_AZO_grid.ParticleFile(name=outname, outputdt=timedelta(hours=1))
80+
pset_AZO_grid.execute(AdvectionRK4, runtime=timedelta(days=simu_length), dt=timedelta(minutes=5),
81+
recovery={ErrorCode.ErrorOutOfBounds: DeleteParticle}, output_file=output_file)
82+
output_file.export() # export the trajectory data to a netcdf file
83+
84+

0 commit comments

Comments
 (0)