Making grid on map -- last minute help for AGU poster

Hi all;

I have 3 more figure to make before I submit my AGU poster by 23:59 tonight EST.

What I am trying to do is create a lines that will either fill with the corresponding color of the regions OR just have text telling which region is which for I created for grouped GPS stations. I suspect the latter may be simply to do given the time constraint I have.

Here is are the plots and the map I want to modify with the overlay.



and here is the map:

The colormap used in the above 3 regional plots is called Roma – and I want to make 3 figures – one for each bin I have. Longitude, Latitude, and Grids; where each bin is colors the same as the corresponding region in the above plots.

Something like this, maybe:

I was trying to modify this function I wrote to create the grids; but I’m having trouble figuring out how to go about it:

# Function to assign regions on (lon,lat) grid
function assign_region(longitude::Float64, latitude::Float64)
    if -125 < longitude && longitude < -115 && 24 < latitude && latitude < 35
        return "Grid_1"
    elseif -125 < longitude && longitude < -115 && 35 <= latitude && latitude < 41
        return "Grid_2"
    elseif -125 < longitude && longitude < -115 && 41 <= latitude && latitude < 50
        return "Grid_3"
    elseif -115 <= longitude && longitude < -100 && 24 < latitude && latitude < 40
        return "Grid_4"
    elseif -115 <= longitude && longitude < -100 && 40 <= latitude && latitude < 50
        return "Grid_5"
    elseif -100 <= longitude && longitude < -85 && 24 <= latitude && latitude < 40
        return "Grid_6"
    elseif -100 <= longitude && longitude < -85 && 40 <= latitude && latitude < 50
        return "Grid_7"
    elseif -85 <= longitude && longitude < -50 && 24 <= latitude && latitude < 40
        return "Grid_8"
    elseif -85 <= longitude && longitude < -50 && 40 <= latitude && latitude < 50
        return "Grid_9"
    else
        return "You messed up somewhere..."
    end
end

And here is the function I wrote for the lon/lat bins.

# Function to assign regions in x-degree longitude increments
function assign_region(longitude::Float64)
    bin_start = floor(longitude / 5) * 5
    bin_end = bin_start + 5
    return "$(Int(bin_end))"
end

Here is what I have so far – it’s just the basemap for each component so far.

using GMT, DelimitedFiles, DataFrames, CSV, Glob

lonlat = gmtread("/home/rob/Documents/julia/gmt_jl/lonlat.txt");


GMT.basemap(region= [-130 -70 24 51], proj = (name = :lambertConic, center = [-100 35], parallels = [33 45]),
    coast = (borders = ((type = 1, pen = ("thick", "black")), (type = 2, pen = ("thinner", "lightgrey"))),
        area = 500,
        shore = (:thinnest, :lightgrey)),
    title = "Longitude Bins"
);

GMT.basemap(region = [-130 -70 24 51],
    proj = (name = :lambertConic, center = [-100 35], parallels = [33 45]),
    coast = (borders = ((type = 1, pen = ("thick", "black")), (type = 2, pen = ("thinner", "lightgrey"))),
        area = 500,
        shore = (:thinnest, :lightgrey)),
    title = "Latitude Bins"
);

GMT.basemap(region = [-130 -70 24 51],
    proj = (name = :lambertConic, center = [-100 35], parallels = [33 45]),
    coast = (borders = ((type = 1, pen = ("thick", "black")), (type = 2, pen = ("thinner", "lightgrey"))),
        area = 500,
        shore = (:thinnest, :lightgrey)),
    title = "Gridded Regions"
);

I’m currently on a flight into Baltimore and I’ll be trying to figure this out while I’m on the flight. Any insight or help is much appreciated!

  • Rob

UPDATE:

This is not the way to do it…it is painstakingly tedious. lol

    arrows!([7.4 5.4 9.1 12.8; 8.6 5.15 10 12.7],
            lw=2, fill=:black, arrow=(length=0,), endpoint=true,
            paper=:grid, noclip=true)

    text!(text="Text", x=14, y=15, justify=:BL, font=18, paper=true, show=1)
end

Adjust each starting and ending point of each line is imprecise and a headache to create a figure every 2-seconds to make the minor adjustments in each direction. lol

Probably too late. Just arrived at the hotel in DC. Didn’t even read all your posts but the image with the red lines could be constructed with a variation of this

julia> I14 = mosaic(-7.966902, 37.042682, provider=:goog, zoom=14);

julia> D15 = mosaic("7829,6374,14", zoom=1, mesh=true);

julia> viz(I14, plot=(data=D15, lc=:red, lw=0.5, labels="attrib=XYZ"))

julia> D15[1].attrib
Dict{String, Union{String, Vector{String}}} with 2 entries:
  "quadtree" => "033110322103210"
  "XYZ"      => "15658,12748,15"

The take out point is if the elements of the GMTdaset vector have a “XYZ” attrib we can easily plot it as text.

PS. We can discuss this on Monday morning after the GMT oral session (or afternoon on poster session)

Joaquim, thank you for your response.

Either way works for me – if it ends up working into your day more easily, my poster session is:

G23C: Reference Frames: Determination, Usage, and Application:
on Tuesday from 1:40 - 5:30, at Board 3599‚ Hall B-C

Either way, looking forward to speaking with you!

I’ll attempt making the grid tomorrow in GMT (doing the rush print job at AGU on Monday). What I ended up doing for the Lat and Lon is creating a map in QGIS – which I haven’t used since undergrad lol but, it’s was fairly quick actually.

  • Rob

Regardless of if talk earlier, I’ll visit your poster, sure.