File:Maya area pdsi july 1980-2020 1.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 630 × 630 pixels, file size: 511 KB)

Captions

Captions

Maya area Palmer's drought index PDSI at July 1980 - 2020

Summary[edit]

Description
English: Maya area Palmer's drought index PDSI at July 1980 - 2020
Date
Source Own work
Author Merikanto

This plot is based on Terraclimate data.

https://www.climatologylab.org/terraclimate.html

Abatzoglou, J.T., S.Z. Dobrowski, S.A. Parks, K.C. Hegewisch, 2018, Terraclimate, a high-resolution global dataset of monthly climate and climatic water balance from 1958-2015, Scientific Data,

Copyrights

To the extent possible under law, John Abatzoglou has waived all copyright and related or neighboring rights to TerraClimate. This work is published from: United States. CC0

"R" code to download and visualize data

must do arter Rscript run "pdf2svg Rplots.pdf maya_area_pdsi_july_1980-2020_1.svg" or somethingg like this, if you want svg image

    1. download and average in year and many years terraclimate data, tex PDSI
  1. R script

library(raster) library(ggplot2) library(dplyr)

library(RColorBrewer)

years1=1980:2020

  1. variable1="soil"

variable1="PDSI"

ext <- extent(c(xmin = -94, xmax = -86, ymin = 14, ymax = 22))
  1. year1=1984

plotting_raster<-function(ras1, year1) { pal <- colorRampPalette(c("brown","yellow","green","blue"))

  1. title1<-paste0("Maya area July",as.character(year1),"moisture")

title1<-paste0("Maya area July drought index PDSI")

plot(ras1,

col=pal(256),

main=title1,

  xlab="longitude",
  ylab="latitude")

contour(ras1, add=T, alpha=50)

points(c(-89.622778 ),c(17.221944 ), col = "red",pch=2, cex=3, lwd=3, add=T) text(c(-89.622778 ),c(17.221944 ), labels=c("Tikal"), cex= 2, pos=3)

  1. dev.off()

system("pdf2svg Rplots.pdf maya_area_ptopet_july_x1.svg")

  1. writeRaster(ras1 , filename="ras1.nc", bandorder='BSQ',
  2. format="NetCDF", overwrite=TRUE)

}

terraclimate_load_plot_year<-function(year1, ext, variable1)

{

  1. download.file(url = 'http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_ppt_2019.nc',
  2. destfile = 'ppt.nc')
    1. pdsi

filename1="http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_" filename2=paste0(variable1,"_") filename3=as.character(year1) filename4=".nc"

url1=paste0(filename1,filename2,filename3, filename4)

print(url1)

  1. quit(-1)

download.file(url = url1 ,

             destfile = 'ppt.nc')

ppt <- stack(x = 'ppt.nc')

print("crop")

ppt <- crop(x = ppt, y = ext)

print("mean") ppt_mean <- calc(ppt, fun = mean, na.rm = TRUE)

  1. ras1<-ppt_mean

ras1= ppt7


crs(ras1)<-"lonlat"


return(ras1)

}
           

rs1<-stack()

for (year1 in years1) { r1<-terraclimate_load_plot_year(year1, ext, variable1) rs1<-stack(rs1, r1) }

rout1 <- calc(rs1, fun = mean, na.rm = TRUE)

writeRaster(rout1 , filename="rout1.nc", bandorder='BSQ',

           format="NetCDF", overwrite=TRUE)
           

plotting_raster(rout1, year1)

  1. plot(rout1)
  1. year1=2000
  2. variable1="PDSI"
  1. terraclimate_load_plot_year(year1, ext, variable1)

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current13:52, 7 January 2024Thumbnail for version as of 13:52, 7 January 2024630 × 630 (511 KB)Merikanto (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata