Skip to content
Snippets Groups Projects
Commit 0f9d161b authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Remove "_1" from the names of shapefiles. That only had sense when we

targetted a single main program.

In script plot_snapshot.py, with option --light, do not plot invalid
outermost contours.
parent 99222d6f
No related branches found
No related tags found
No related merge requests found
Showing
with 72 additions and 68 deletions
......@@ -2,7 +2,9 @@
"""Plots outermost contours and max-speed contours.
Red for anti-cyclones, blue for cyclones. Empty circles for extrema
Red for anti-cyclones, blue for cyclones.
Without the --light option. Empty circles for extrema
with a valid outermost contour, empty squares for other
extrema. Squares on outermost contour for a well-defined but invalid
outermost contour. Crosses on outermost contour for a valid outermost
......@@ -10,6 +12,9 @@ contour but with no distinct max-speed contour. Filled circles on
outermost contour and max-speed contour for a valid outermost contour
with a distinct max-speed contour.
With the --light option. Crosses for extrema with a valid outermost
contour.
This scripts takes about 30 s of CPU for a 90° by 90° window, about 4
mn for a 180° by 180° window.
......@@ -118,7 +123,8 @@ for shape_rec_extr, shape_outer, shape_m_s \
src_crs),
xytext = (3, 3), textcoords = "offset points")
if shape_outer.shapeType != shapefile.NULL:
if shape_outer.shapeType != shapefile.NULL and not args.light \
or shape_rec_extr.record.valid:
points = np.array(shape_outer.points)
lines = ax.plot(points[:, 0], points[:, 1], color = color,
transform = src_crs)
......
......@@ -204,32 +204,32 @@
"args": "$compil_prod_dir/test_read_eddy",
"required":
[
["$input_dir/Region_4/extremum_1.dbf", "extremum_1_old.dbf"],
["$input_dir/Region_4/extremum_1.shp", "extremum_1_old.shp"],
["$input_dir/Region_4/extremum_1.shx", "extremum_1_old.shx"],
["$input_dir/Region_4/extremum.dbf", "extremum_old.dbf"],
["$input_dir/Region_4/extremum.shp", "extremum_old.shp"],
["$input_dir/Region_4/extremum.shx", "extremum_old.shx"],
[
"$input_dir/Region_4/max_speed_contour_1.dbf",
"max_speed_contour_1_old.dbf"
"$input_dir/Region_4/max_speed_contour.dbf",
"max_speed_contour_old.dbf"
],
[
"$input_dir/Region_4/max_speed_contour_1.shp",
"max_speed_contour_1_old.shp"
"$input_dir/Region_4/max_speed_contour.shp",
"max_speed_contour_old.shp"
],
[
"$input_dir/Region_4/max_speed_contour_1.shx",
"max_speed_contour_1_old.shx"
"$input_dir/Region_4/max_speed_contour.shx",
"max_speed_contour_old.shx"
],
[
"$input_dir/Region_4/outermost_contour_1.dbf",
"outermost_contour_1_old.dbf"
"$input_dir/Region_4/outermost_contour.dbf",
"outermost_contour_old.dbf"
],
[
"$input_dir/Region_4/outermost_contour_1.shp",
"outermost_contour_1_old.shp"
"$input_dir/Region_4/outermost_contour.shp",
"outermost_contour_old.shp"
],
[
"$input_dir/Region_4/outermost_contour_1.shx",
"outermost_contour_1_old.shx"
"$input_dir/Region_4/outermost_contour.shx",
"outermost_contour_old.shx"
]
],
"title": "Read_eddy"
......@@ -238,32 +238,32 @@
"args": "$compil_prod_dir/test_read_snapshot",
"required":
[
["$input_dir/Region_4/extremum_1.dbf", "extremum_1_old.dbf"],
["$input_dir/Region_4/extremum_1.shp", "extremum_1_old.shp"],
["$input_dir/Region_4/extremum_1.shx", "extremum_1_old.shx"],
["$input_dir/Region_4/extremum.dbf", "extremum_old.dbf"],
["$input_dir/Region_4/extremum.shp", "extremum_old.shp"],
["$input_dir/Region_4/extremum.shx", "extremum_old.shx"],
[
"$input_dir/Region_4/max_speed_contour_1.dbf",
"max_speed_contour_1_old.dbf"
"$input_dir/Region_4/max_speed_contour.dbf",
"max_speed_contour_old.dbf"
],
[
"$input_dir/Region_4/max_speed_contour_1.shp",
"max_speed_contour_1_old.shp"
"$input_dir/Region_4/max_speed_contour.shp",
"max_speed_contour_old.shp"
],
[
"$input_dir/Region_4/max_speed_contour_1.shx",
"max_speed_contour_1_old.shx"
"$input_dir/Region_4/max_speed_contour.shx",
"max_speed_contour_old.shx"
],
[
"$input_dir/Region_4/outermost_contour_1.dbf",
"outermost_contour_1_old.dbf"
"$input_dir/Region_4/outermost_contour.dbf",
"outermost_contour_old.dbf"
],
[
"$input_dir/Region_4/outermost_contour_1.shp",
"outermost_contour_1_old.shp"
"$input_dir/Region_4/outermost_contour.shp",
"outermost_contour_old.shp"
],
[
"$input_dir/Region_4/outermost_contour_1.shx",
"outermost_contour_1_old.shx"
"$input_dir/Region_4/outermost_contour.shx",
"outermost_contour_old.shx"
]
],
"title": "Read_snapshot",
......@@ -294,15 +294,15 @@
"required":
[
[
"$tests_old_dir/Extraction_eddies_region_1_noise/extremum_1.shp",
"$tests_old_dir/Extraction_eddies_region_1_noise/extremum.shp",
"extremum.shp"
],
[
"$tests_old_dir/Extraction_eddies_region_1_noise/extremum_1.shx",
"$tests_old_dir/Extraction_eddies_region_1_noise/extremum.shx",
"extremum.shx"
],
[
"$tests_old_dir/Extraction_eddies_region_1_noise/extremum_1.dbf",
"$tests_old_dir/Extraction_eddies_region_1_noise/extremum.dbf",
"extremum.dbf"
],
[
......@@ -317,9 +317,9 @@
"description": "Same as Successive_overlap, but with larger domain: region 5 instead of region 4.",
"required":
[
"$tests_old_dir/Extraction_eddies_region_5/extremum_1.*",
"$tests_old_dir/Extraction_eddies_region_5/max_speed_contour_1.*",
"$tests_old_dir/Extraction_eddies_region_5/outermost_contour_1.*"
"$tests_old_dir/Extraction_eddies_region_5/extremum.*",
"$tests_old_dir/Extraction_eddies_region_5/max_speed_contour.*",
"$tests_old_dir/Extraction_eddies_region_5/outermost_contour.*"
],
"stdin_filename": "$input_dir/successive_overlap_region_5_nml.txt"
},
......
......@@ -14,16 +14,16 @@ program test_read_eddy
type(eddy) e
integer k, i
TYPE(shpfileobject) hshp_extremum ! shapefile extremum_1
TYPE(shpfileobject) hshp_outermost ! shapefile outermost_contour_1
TYPE(shpfileobject) hshp_max_speed ! shapefile max_speed_contour_1
TYPE(shpfileobject) hshp_extremum ! shapefile extremum
TYPE(shpfileobject) hshp_outermost ! shapefile outermost_contour
TYPE(shpfileobject) hshp_max_speed ! shapefile max_speed_contour
!-------------------------------------------------------------------------
call shp_open_03("extremum_1_old", pszaccess = "rb", hshp = hshp_extremum)
call shp_open_03("outermost_contour_1_old", pszaccess = "rb", &
call shp_open_03("extremum_old", pszaccess = "rb", hshp = hshp_extremum)
call shp_open_03("outermost_contour_old", pszaccess = "rb", &
hshp = hshp_outermost)
call shp_open_03("max_speed_contour_1_old", pszaccess = "rb", &
call shp_open_03("max_speed_contour_old", pszaccess = "rb", &
hshp = hshp_max_speed)
call read_field_indices(hshp_extremum, hshp_outermost, hshp_max_speed)
call read_eddy(e, k, i, hshp_extremum, hshp_outermost, hshp_max_speed, &
......@@ -35,10 +35,10 @@ program test_read_eddy
call init_shapefiles(hshp_extremum, hshp_outermost, hshp_max_speed)
call write_eddy(e, k, i, hshp_extremum, hshp_outermost, hshp_max_speed)
CALL shpclose(hshp_extremum)
print *, 'Created shapefile "extremum_1".'
print *, 'Created shapefile "extremum".'
CALL shpclose(hshp_outermost)
print *, 'Created shapefile "outermost_contour_1".'
print *, 'Created shapefile "outermost_contour".'
CALL shpclose(hshp_max_speed)
print *, 'Created shapefile "max_speed_contour_1".'
print *, 'Created shapefile "max_speed_contour".'
end program test_read_eddy
......@@ -15,9 +15,9 @@ program test_read_snapshot
implicit none
type(snapshot) s
TYPE(shpfileobject) hshp_extremum ! shapefile extremum_1
TYPE(shpfileobject) hshp_outermost ! shapefile outermost_contour_1
TYPE(shpfileobject) hshp_max_speed ! shapefile max_speed_contour_1
TYPE(shpfileobject) hshp_extremum ! shapefile extremum
TYPE(shpfileobject) hshp_outermost ! shapefile outermost_contour
TYPE(shpfileobject) hshp_max_speed ! shapefile max_speed_contour
integer i
real:: corner(2) = [0.125, - 59.875]
......@@ -33,10 +33,10 @@ program test_read_snapshot
read(unit = *, nml = main_nml)
write(unit = *, nml = main_nml)
call shp_open_03("extremum_1_old", pszaccess = "rb", hshp = hshp_extremum)
call shp_open_03("outermost_contour_1_old", pszaccess = "rb", &
call shp_open_03("extremum_old", pszaccess = "rb", hshp = hshp_extremum)
call shp_open_03("outermost_contour_old", pszaccess = "rb", &
hshp = hshp_outermost)
call shp_open_03("max_speed_contour_1_old", pszaccess = "rb", &
call shp_open_03("max_speed_contour_old", pszaccess = "rb", &
hshp = hshp_max_speed)
call read_snapshot(s, hshp_extremum, hshp_outermost, hshp_max_speed, &
corner * deg_to_rad, nlon, nlat)
......@@ -54,11 +54,11 @@ program test_read_snapshot
print *, "Number of extrema:", s%number_vis_extr
CALL shpclose(hshp_extremum)
print *, 'Created shapefile "extremum_1".'
print *, 'Created shapefile "extremum".'
CALL shpclose(hshp_outermost)
print *, 'Created shapefile "outermost_contour_1".'
print *, 'Created shapefile "outermost_contour".'
CALL shpclose(hshp_max_speed)
print *, 'Created shapefile "max_speed_contour_1".'
print *, 'Created shapefile "max_speed_contour".'
print *, "s%ind_extr:"
......
......@@ -16,9 +16,9 @@ program test_successive_overlap
integer unit_edgelist, i
type(snapshot) flow(2)
TYPE(shpfileobject) hshp_extremum ! shapefile extremum_1
TYPE(shpfileobject) hshp_outermost ! shapefile outermost_contour_1
TYPE(shpfileobject) hshp_max_speed ! shapefile max_speed_contour_1
TYPE(shpfileobject) hshp_extremum ! shapefile extremum
TYPE(shpfileobject) hshp_outermost ! shapefile outermost_contour
TYPE(shpfileobject) hshp_max_speed ! shapefile max_speed_contour
real:: corner(2) = [huge(0.), huge(0.)]
! longitude and latitude of the corner of the whole grid, in degrees
......@@ -33,10 +33,10 @@ program test_successive_overlap
read(unit = *, nml = main_nml)
write(unit = *, nml = main_nml)
call shp_open_03("extremum_1", pszaccess = "rb", hshp = hshp_extremum)
call shp_open_03("outermost_contour_1", pszaccess = "rb", &
call shp_open_03("extremum", pszaccess = "rb", hshp = hshp_extremum)
call shp_open_03("outermost_contour", pszaccess = "rb", &
hshp = hshp_outermost)
call shp_open_03("max_speed_contour_1", pszaccess = "rb", &
call shp_open_03("max_speed_contour", pszaccess = "rb", &
hshp = hshp_max_speed)
call read_snapshot(flow(1), hshp_extremum, hshp_outermost, hshp_max_speed, &
corner * deg_to_rad, nlon, nlat)
......
......@@ -91,8 +91,6 @@ program extraction_eddies
call nf95_get_var(ncid, varid, lat_min)
call nf95_get_var(ncid, varid, lat_max, start = [nlat])
call nf95_close(ncid)
call assert(lon_max > lon_min .and. lat_max > lat_min, &
"extraction_eddies coordinate order")
step = [(lon_max - lon_min) / (nlon - 1), (lat_max - lat_min) / (nlat - 1)] &
......@@ -112,7 +110,6 @@ program extraction_eddies
! Read ssh, u and v at date k:
call nf95_open("h.nc", nf90_nowrite, ncid)
call get_var(periodic, max_radius(1), ssh, ncid, nlon, k, name = "adt", &
new_fill_value = huge(0.))
! (We cannot keep the original fill value because Contour_531
......
......@@ -28,7 +28,7 @@ contains
!---------------------------------------------------------------------
call shp_create_03("extremum_1", shpt_point, hshp_extremum)
call shp_create_03("extremum", shpt_point, hshp_extremum)
call dbf_add_field_03(ifield_extr_ssh, hshp_extremum, 'ssh', ftdouble, &
nwidth = 13, ndecimals = 6)
call dbf_add_field_03(ifield_extr_date, hshp_extremum, 'date_index', &
......@@ -44,7 +44,7 @@ contains
call dbf_add_field_03(ifield_extr_speed, hshp_extremum, 'speed', ftdouble, &
nwidth = 13, ndecimals = 6)
call shp_create_03("outermost_contour_1", shpt_polygon, hshp_outermost)
call shp_create_03("outermost_contour", shpt_polygon, hshp_outermost)
call dbf_add_field_03(ifield_out_r_eq_area, hshp_outermost, &
'r_eq_area', ftdouble, nwidth = 10, ndecimals = 4)
call dbf_add_field_03(ifield_out_ssh, hshp_outermost, 'ssh', ftdouble, &
......@@ -56,7 +56,7 @@ contains
call dbf_add_field_03(ifield_out_radius4, hshp_outermost, 'radius4', &
ftinteger, nwidth = 2, ndecimals = 0)
call shp_create_03("max_speed_contour_1", shpt_polygon, hshp_max_speed)
call shp_create_03("max_speed_contour", shpt_polygon, hshp_max_speed)
call dbf_add_field_03(ifield_max_speed_r_eq_area, hshp_max_speed, &
'r_eq_area', ftdouble, nwidth = 10, ndecimals = 4)
call dbf_add_field_03(ifield_max_speed_ssh, hshp_max_speed, 'ssh', &
......
......@@ -141,6 +141,7 @@ contains
if (abs(s%list_vis(i)%ssh_extr - innermost_level(i)) < min_amp) &
innermost_level(i) = s%list_vis(i)%ssh_extr &
+ merge(min_amp, - min_amp, s%list_vis(i)%cyclone)
outside_points = nearby_extr(s%extr_map(llc(1):urc(1), llc(2):urc(2)), &
s%list_vis, i)
if (periodic) outside_points(1, :) = outside_points(1, :) &
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment