Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plots #24

Merged
merged 9 commits into from
Jul 28, 2022
Next Next commit
Added a function plot_datacube
  • Loading branch information
Tumon2001 committed Jul 14, 2022
commit 02835d9d99071ac680d542e9802909ea893de217
53 changes: 53 additions & 0 deletions src/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,57 @@ function plot_img(img, coordinate_system)
ylabel!("latitude")
end

"""
load_example()
april2012=radiance_datacube[:,:,1]
plot_img(april2012, MUMBAI_COORDINATE_SYSTEM)
"""
function plot_datacube(datacube, coordinate_system)
month=["April, ", "May, ", "June, ", "July, ", "August, ", "September, ", "October, ", "November, ", "December, ", "January, ", "February, ", "March, "]
year=["2012","2013","2014","2015","2016","2017","2018","2019","2020"]
map=[]

function plot_img(img, coordinate_system, i)

function lat(c, a, b)
return round(image_to_coordinate(c, [a, b]).latitude; digits=2)
end

function lon(c, a, b)
return round(image_to_coordinate(c, [a, b]).longitude; digits=2)
end

a=size(img)[1]/6
b=size(img)[2]/5
c=coordinate_system

xc=[b, 2*b, 3*b, 4*b]
yc=[a, 2*a, 3*a, 4*a, 5*a]
xcs=[lon(c,1,b), lon(c,1,2*b), lon(c,1,3*b), lon(c,1,4*b)]
ycs=[lat(c,a,1), lat(c,2*a,1), lat(c,3*a,1), lat(c,4*a,1), lat(c,5*a,1)]

if (mod(i,12)>0)
s=month[Int64(mod(i,12))]*year[Int64(ceil((i+3)/12))]
else
s=month[12]*year[Int64(ceil((i+3)/12))]
end

p=plot(Gray.(img), title=s, xlabel="longitude", ylabel="latitude")
plot!(xc, seriestype=:vline, xticks = (xc,xcs), label="", color=:red, linestyle=:dot)
plot!(yc, seriestype=:hline, yticks = (yc,ycs), label="", color=:red, linestyle=:dot)

append!(map, [p])
end

for i in 1:size(datacube)[3]
img=datacube[:, :, i]
plot_img(img, coordinate_system, i)
end

Plots.GR.beginprint("mumbai.pdf")
gr(show=true)
for i in 1:size(datacube)[3]
plot(map[i])
end
Plots.GR.endprint()
end