diff --git a/Common/read_field_indices.F90 b/Common/read_field_indices.F90 index 665285f2db0967bdbcf878118c1f762386ca7f5a..eb2873c459dece6d733b71deea1a0a6023725679 100644 --- a/Common/read_field_indices.F90 +++ b/Common/read_field_indices.F90 @@ -21,7 +21,7 @@ contains if (rank == 0) then call dbf_get_field_index_03(hshp%extremum, "ssh", hshp%extr_ssh) - call dbf_get_field_index_03(hshp%extremum, "days_1950", hshp%extr_date) + call dbf_get_field_index_03(hshp%extremum, "date", hshp%extr_date) call dbf_get_field_index_03(hshp%extremum, "eddy_index", & hshp%extr_eddy_index) call dbf_get_field_index_03(hshp%extremum, "valid", hshp%extr_valid) @@ -30,7 +30,7 @@ contains call dbf_get_field_index_03(hshp%outermost, "r_eq_area", & hshp%out_r_eq_area) call dbf_get_field_index_03(hshp%outermost, "ssh", hshp%out_ssh) - call dbf_get_field_index_03(hshp%outermost, "days_1950", hshp%out_date) + call dbf_get_field_index_03(hshp%outermost, "date", hshp%out_date) call dbf_get_field_index_03(hshp%outermost, "eddy_index", & hshp%out_eddy_index) call dbf_get_field_index_03(hshp%outermost, "radius4", hshp%out_radius4) @@ -38,8 +38,7 @@ contains call dbf_get_field_index_03(hshp%max_speed, "r_eq_area", & hshp%max_speed_r_eq_area) call dbf_get_field_index_03(hshp%max_speed, "ssh", hshp%max_speed_ssh) - call dbf_get_field_index_03(hshp%max_speed, "days_1950", & - hshp%max_speed_date) + call dbf_get_field_index_03(hshp%max_speed, "date", hshp%max_speed_date) call dbf_get_field_index_03(hshp%max_speed, "eddy_index", & hshp%max_speed_eddy_index) end if diff --git a/Common/read_snapshot.f90 b/Common/read_snapshot.f90 index 295d3c9121a1104af0a15b2ddf4279d278fc63f6..f2e8142f854923b39e17f3b1b539d60aa2f26f3e 100644 --- a/Common/read_snapshot.f90 +++ b/Common/read_snapshot.f90 @@ -35,7 +35,7 @@ contains ! Local: integer ishape, ishape_first - integer d ! date, in days since 1950-1-1 + integer d ! date integer i ! eddy index type(eddy) e diff --git a/Common/shpc_create.f90 b/Common/shpc_create.f90 index 0c896b6b3dd2b0ab6ac778e09c3f60fcd6e2434f..12ad0cb025d226013059997724c2af2e5accae33 100644 --- a/Common/shpc_create.f90 +++ b/Common/shpc_create.f90 @@ -26,7 +26,7 @@ contains hshp%extremum) call dbf_add_field_03(hshp%extr_ssh, hshp%extremum, 'ssh', ftdouble, & nwidth = 13, ndecimals = 6) - call dbf_add_field_03(hshp%extr_date, hshp%extremum, 'days_1950', & + call dbf_add_field_03(hshp%extr_date, hshp%extremum, 'date', & ftinteger, nwidth = 5, ndecimals = 0) call dbf_add_field_03(hshp%extr_eddy_index, hshp%extremum, 'eddy_index', & ftinteger, nwidth = 5, ndecimals = 0) @@ -41,7 +41,7 @@ contains 'r_eq_area', ftdouble, nwidth = 10, ndecimals = 4) call dbf_add_field_03(hshp%out_ssh, hshp%outermost, 'ssh', ftdouble, & nwidth = 13, ndecimals = 6) - call dbf_add_field_03(hshp%out_date, hshp%outermost, 'days_1950', & + call dbf_add_field_03(hshp%out_date, hshp%outermost, 'date', & ftinteger, nwidth = 5, ndecimals = 0) call dbf_add_field_03(hshp%out_eddy_index, hshp%outermost, 'eddy_index', & ftinteger, nwidth = 5, ndecimals = 0) @@ -54,7 +54,7 @@ contains 'r_eq_area', ftdouble, nwidth = 10, ndecimals = 4) call dbf_add_field_03(hshp%max_speed_ssh, hshp%max_speed, 'ssh', & ftdouble, nwidth = 13, ndecimals = 6) - call dbf_add_field_03(hshp%max_speed_date, hshp%max_speed, 'days_1950', & + call dbf_add_field_03(hshp%max_speed_date, hshp%max_speed, 'date', & ftinteger, nwidth = 5, ndecimals = 0) call dbf_add_field_03(hshp%max_speed_eddy_index, hshp%max_speed, & 'eddy_index', ftinteger, nwidth = 5, ndecimals = 0) diff --git a/Common/util_eddies.py b/Common/util_eddies.py index a4be56cb8438df07c2aabb748f4a70d7dc8d5e85..9dfb101218d2096203e0a50d471369539b31d35e 100644 --- a/Common/util_eddies.py +++ b/Common/util_eddies.py @@ -3,8 +3,8 @@ import math from os import path import numpy as np -def comp_ishape(handler, days_1950, eddy_index): - k = days_1950 - handler["d_init"] +def comp_ishape(handler, date, eddy_index): + k = date - handler["d_init"] if k == 0: ishape = eddy_index - 1 @@ -31,7 +31,7 @@ def open_shpc(shpc_dir): except shapefile.ShapefileException: print(f"Shapefile {layer} not found in {shpc_dir}.") - handler["d_init"] = handler["readers"]["extremum"].record(0).days_1950 + handler["d_init"] = handler["readers"]["extremum"].record(0).date fname = path.join(shpc_dir, "ishape_last.txt") try: diff --git a/Common/write_eddy.f90 b/Common/write_eddy.f90 index 5b22294efae02ae1289bab6ebf05618dbe1a9673..22fa2ff7468aa182d1162b762d0a097a1468cbb1 100644 --- a/Common/write_eddy.f90 +++ b/Common/write_eddy.f90 @@ -4,7 +4,7 @@ module write_eddy_m contains - subroutine write_eddy(e, hshp, days_1950, i) + subroutine write_eddy(e, hshp, date, i) use, intrinsic:: ieee_arithmetic, only: ieee_is_nan @@ -18,7 +18,7 @@ contains type(eddy), intent(in):: e TYPE(shpc), intent(in):: hshp - integer, intent(in):: days_1950 ! date + integer, intent(in):: date integer, intent(in):: i ! eddy index ! Local: @@ -32,8 +32,7 @@ contains call dbf_write_attribute_03(hshp%extremum, ishape, hshp%extr_ssh, & e%ssh_extr) - call dbf_write_attribute_03(hshp%extremum, ishape, hshp%extr_date, & - days_1950) + call dbf_write_attribute_03(hshp%extremum, ishape, hshp%extr_date, date) call dbf_write_attribute_03(hshp%extremum, ishape, hshp%extr_eddy_index, i) call dbf_write_attribute_03(hshp%extremum, ishape, hshp%extr_valid, & merge(1, 0, e%valid)) @@ -71,8 +70,7 @@ contains call dbf_write_attribute_03(hshp%outermost, ishape, hshp%out_ssh, & e%out_cont%ssh) - call dbf_write_attribute_03(hshp%outermost, ishape, hshp%out_date, & - days_1950) + call dbf_write_attribute_03(hshp%outermost, ishape, hshp%out_date, date) call dbf_write_attribute_03(hshp%outermost, ishape, hshp%out_eddy_index, & i) call dbf_write_attribute_03(hshp%outermost, ishape, hshp%out_radius4, & @@ -89,7 +87,7 @@ contains call dbf_write_attribute_03(hshp%max_speed, ishape, hshp%max_speed_ssh, & e%speed_cont%ssh) call dbf_write_attribute_03(hshp%max_speed, ishape, hshp%max_speed_date, & - days_1950) + date) call dbf_write_attribute_03(hshp%max_speed, ishape, & hshp%max_speed_eddy_index, i) diff --git a/Convert_Matlab/inst_eddies_v6.py b/Convert_Matlab/inst_eddies_v6.py index 64d727209375574a9c9e23c215341af8995041d8..ee5731035a891820ec76406d04a4f6dce34c0836 100755 --- a/Convert_Matlab/inst_eddies_v6.py +++ b/Convert_Matlab/inst_eddies_v6.py @@ -28,22 +28,22 @@ def define_fields(writers): """writers is a dictionary of shapefile.Writer objects.""" writers["extr"].field("ssh", "N", 13, 6) - writers["extr"].field("days_1950", "N", 5) + writers["extr"].field("date", "N", 5) writers["extr"].field("eddy_index", "N", 5) writers["extr"].field("valid", "N", 1) writers["extr"].field("speed", "N", 13, 6) - writers["centroid"].field("days_1950", "N", 5) + writers["centroid"].field("date", "N", 5) writers["centroid"].field("eddy_index", "N", 5) writers["outer"].field("r_eq_area", "N", 10, 4) writers["outer"].field("ssh", "N", 13, 6) - writers["outer"].field("days_1950", "N", 5) + writers["outer"].field("date", "N", 5) writers["outer"].field("eddy_index", "N", 5) writers["max_speed"].field("r_eq_area", "N", 10, 4) writers["max_speed"].field("ssh", "N", 13, 6) - writers["max_speed"].field("days_1950", "N", 5) + writers["max_speed"].field("date", "N", 5) writers["max_speed"].field("eddy_index", "N", 5) def write_to_shp(writers, cyclone, d, cell = None, X = None, Y = None, @@ -78,7 +78,7 @@ def write_to_shp(writers, cyclone, d, cell = None, X = None, Y = None, j = np.argwhere(Y == eddy[1]).item() speed = 1e4 if np.isnan(eddy[12]) else eddy[12] # Azimuthal Vit writers["extr"].record(ssh = ADT[i, j], valid = 1, - days_1950 = d, eddy_index = eddy_index, + date = d, eddy_index = eddy_index, speed = speed) # Amplitude Out: @@ -88,11 +88,10 @@ def write_to_shp(writers, cyclone, d, cell = None, X = None, Y = None, ssh = ADT[i, j] - eddy[7] writers["centroid"].point(eddy[2], eddy[3]) # [XY]centroid - writers["centroid"].record(days_1950 = d, - eddy_index = eddy_index) + writers["centroid"].record(date = d, eddy_index = eddy_index) writers["outer"].record(r_eq_area = eddy[6], ssh = ssh, - days_1950 = d, eddy_index = eddy_index) + date = d, eddy_index = eddy_index) # (eddy[6] is Equivalent Radius Out) polyline = np.stack((eddy[4], eddy[5]), axis = 1).tolist() @@ -107,8 +106,7 @@ def write_to_shp(writers, cyclone, d, cell = None, X = None, Y = None, ssh = ADT[i, j] - eddy[11] writers["max_speed"].record(r_eq_area = eddy[10], ssh = ssh, - days_1950 = d, - eddy_index = eddy_index) + date = d, eddy_index = eddy_index) # (eddy[10] is Equivalent Radius Vit) polyline = np.stack((eddy[8], eddy[9]), axis = 1).tolist() diff --git a/Inst_eddies/Analysis/eddy_dump.py b/Inst_eddies/Analysis/eddy_dump.py index 1eb2c95914c7cffedfb9b13737f9dd65c13ff4aa..5fd2bff0fef1d0c1e91990f43d6a75fc1a3403c2 100755 --- a/Inst_eddies/Analysis/eddy_dump.py +++ b/Inst_eddies/Analysis/eddy_dump.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -"""Dumps all information on a particular eddy, specified by days_1950 +"""Dumps all information on a particular eddy, specified by date and eddy_index. """ @@ -23,8 +23,8 @@ handler = util_eddies.open_shpc(args.directory) if args.ishape: ishape = args.ishape else: - reply = input("days_1950, eddy_index = ? ").split(",") - days_1950 = int(reply[0]) + reply = input("date, eddy_index = ? ").split(",") + date = int(reply[0]) eddy_index = int(reply[1]) # Find ishape: @@ -33,13 +33,13 @@ else: for ishape, rec \ in enumerate(handler["readers"]["extremum"].iterRecords()): - if rec["days_1950"] == days_1950 \ + if rec["date"] == date \ and rec["eddy_index"] == eddy_index: break else: sys.exit("Eddy with this date and index not found") else: - ishape = util_eddies.comp_ishape(handler, days_1950, eddy_index) + ishape = util_eddies.comp_ishape(handler, date, eddy_index) for layer in ["extremum", "outermost_contour", "max_speed_contour", "centroid"]: if layer in handler["readers"]: diff --git a/Inst_eddies/Tests/test_get_1_outerm.f90 b/Inst_eddies/Tests/test_get_1_outerm.f90 index 52869b1e91bb4cf90d4ab86072de36ff52a2aba4..bb5a02557a9fed2ce755f3afb256b1c100cd9613 100644 --- a/Inst_eddies/Tests/test_get_1_outerm.f90 +++ b/Inst_eddies/Tests/test_get_1_outerm.f90 @@ -17,7 +17,7 @@ program test_get_1_outerm implicit none - integer ncid, varid, unit, n, l, days_1950 + integer ncid, varid, unit, n, l, date real longitude(2) ! in rad real latitude(2) ! in rad real step(2) ! in rad @@ -61,8 +61,8 @@ program test_get_1_outerm call nf95_gw_var(ncid, varid, ssh) call nf95_close(ncid) - print *, "days_1950 = ?" - read *, days_1950 + print *, "date = ?" + read *, date step = [longitude(2) - longitude(1), latitude(2) - latitude(1)] print *, "Reading from outside_points.csv..." @@ -97,7 +97,7 @@ program test_get_1_outerm e%radius4 = - 1 e%valid = .true. call shpc_create(hshp, shpc_dir = "SHPC", cyclone = cyclone) - call write_eddy(e, hshp, days_1950, i = 1) + call write_eddy(e, hshp, date, i = 1) CALL shpc_close(hshp) print *, 'Created "SHPC".' else diff --git a/Inst_eddies/Tests/test_set_all_outerm.f90 b/Inst_eddies/Tests/test_set_all_outerm.f90 index 27d5323da4663a93690de01352746295fca04972..dcb4be66038600195101aefc38c7f8231378de20 100644 --- a/Inst_eddies/Tests/test_set_all_outerm.f90 +++ b/Inst_eddies/Tests/test_set_all_outerm.f90 @@ -96,10 +96,10 @@ program test_set_all_outerm do i = 1, s%number_extr if (s%list(i)%cyclone) then n_cyclo = n_cyclo + 1 - call write_eddy(s%list(i), hshp_cyclo, days_1950 = 1, i = n_cyclo) + call write_eddy(s%list(i), hshp_cyclo, date = 1, i = n_cyclo) else n_anti = n_anti + 1 - call write_eddy(s%list(i), hshp_anti, days_1950 = 1, i = n_anti) + call write_eddy(s%list(i), hshp_anti, date = 1, i = n_anti) end if end do diff --git a/Inst_eddies/inst_eddies.f90 b/Inst_eddies/inst_eddies.f90 index 3a3c9e270185cb924feaf7dd13045601079014c1..735d1d927b465bb46cb3060a7dee020e8e8d7f68 100644 --- a/Inst_eddies/inst_eddies.f90 +++ b/Inst_eddies/inst_eddies.f90 @@ -26,7 +26,7 @@ program inst_eddies type(snapshot) s TYPE(shpc) hshpc_cyclo, hshpc_anti - integer i, days_1950, n_cyclo, n_anti + integer i, date, n_cyclo, n_anti integer ncid, dimid, varid, copy @@ -74,8 +74,8 @@ program inst_eddies "inst_eddies: not enough IEEE support") inquire(file = "SHPC_cyclo/extremum.shp", exist = exist) call config(exist) ! We need main_nml before looking at the input files. - print *, "days_1950 = ?" - read *, days_1950 + print *, "date = ?" + read *, date call nf95_open("h.nc", nf90_nowrite, ncid) @@ -187,10 +187,10 @@ program inst_eddies do i = 1, s%number_extr if (s%list(i)%cyclone) then n_cyclo = n_cyclo + 1 - call write_eddy(s%list(i), hshpc_cyclo, days_1950, n_cyclo) + call write_eddy(s%list(i), hshpc_cyclo, date, n_cyclo) else n_anti = n_anti + 1 - call write_eddy(s%list(i), hshpc_anti, days_1950, n_anti) + call write_eddy(s%list(i), hshpc_anti, date, n_anti) end if end do diff --git a/Overlap/get_snapshot.f90 b/Overlap/get_snapshot.f90 index dd905cd5273ff2bc5ff2aa7fc4b941292eab3a9f..b2fa3cf3182de0516007776272d791993eabece3 100644 --- a/Overlap/get_snapshot.f90 +++ b/Overlap/get_snapshot.f90 @@ -24,10 +24,7 @@ contains real, intent(in):: step(:) ! (2) longitude and latitude steps, in rad integer, intent(in):: copy TYPE(shpc), intent(in):: hshp - - integer, intent(in):: d_init - ! first date in the collection of shapefiles, in days since 1950-1-1 - + integer, intent(in):: d_init ! first date in the collection of shapefiles integer, intent(in):: k ! date index integer, intent(in):: k_end ! last date index analyzed by this MPI process integer, intent(in):: rank ! of MPI process diff --git a/Overlap/plot_traj.py b/Overlap/plot_traj.py index cf4a2200b4ea72de5c7b1d38db54230ebe16dbdf..3ece8f90e8d66f7f9076eabb6a899aab0138c7e1 100755 --- a/Overlap/plot_traj.py +++ b/Overlap/plot_traj.py @@ -37,7 +37,7 @@ def is_node_type(G, n, label): elif label == "important": return G.in_degree[n] == 0 or G.out_degree[n] == 0 or G.degree[n] >= 3 elif isinstance(label, int): - return node_to_date_eddy(n, e_overestim, d_init)["days_1950"] == label + return node_to_date_eddy(n, e_overestim, d_init)["date"] == label def plot_nbunch(G, nbunch, color = '#1f78b4', label = None, ax = None): if ax is None: ax = plt.gca() diff --git a/Overlap/report_graph.py b/Overlap/report_graph.py index c8e695b6b45c6909cbc2affe19b8540b61673c37..4c4c9bf672b8f1003874345befdc1bf9d66a531e 100755 --- a/Overlap/report_graph.py +++ b/Overlap/report_graph.py @@ -20,7 +20,7 @@ def node_to_date_eddy(node_index, e_overestim, d_init): k = (node_index - 1) // e_overestim d = d_init + k return {"eddy_index": node_index - k * e_overestim, "date_index": k, - "days_1950": d} + "date": d} def date_eddy_to_node(d, eddy_index, e_overestim, d_init): """Convert from eddy identification in shapefiles to node @@ -52,7 +52,7 @@ def read_eddy_graph(edgelist, shpc_dir = None): def set_attribute(G, extr_file): with shapefile.Reader(extr_file) as s_read: for shape_rec in s_read: - n = date_eddy_to_node(shape_rec.record.days_1950, + n = date_eddy_to_node(shape_rec.record.date, shape_rec.record.eddy_index, G.graph["e_overestim"], G.graph["d_init"]) @@ -68,10 +68,10 @@ def to_eddy_agraph(G): date_eddy = node_to_date_eddy(n, G.graph["e_overestim"], G.graph["d_init"]) - if date_eddy["days_1950"] not in my_subgraphs: - my_subgraphs[date_eddy["days_1950"]] = [] + if date_eddy["date"] not in my_subgraphs: + my_subgraphs[date_eddy["date"]] = [] - my_subgraphs[date_eddy["days_1950"]].append(n) + my_subgraphs[date_eddy["date"]].append(n) A = nx_agraph.to_agraph(G) @@ -110,7 +110,7 @@ if __name__ == "__main__": action = "store_true") parser.add_argument("-n", "--node", help = "Select component containing node", nargs = 2, - type = int, metavar = ("days_1950", "eddy_index")) + type = int, metavar = ("date", "eddy_index")) parser.add_argument("-m", "--merging", help = "Report merging and splitting events", action = "store_true")