File:Maya area july precipitation difference 2004 1980 1.svg

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

Original file(SVG file, nominally 496 × 576 pixels, file size: 3.86 MB)

Captions

Captions

Maya area July precipitation difference 2004 - 1980

Summary[edit]

Description
English: Maya area July precipitation difference 2004 - 1980. Note that in south "dry" year North Yucatan gathers more rainfall in summer.
Date
Source Own work
Author Merikanto

This plotting is based on Chelsa Cruts precipitation data

Karger, D.N., Conrad, O., Böhner, J., Kawohl, T., Kreft, H., Soria-Auza, R.W., Zimmermann, N.E., Linder, H.P. & Kessler, M. (2017): Climatologies at high resolution for the earth’s land surface areas. Scientific Data. 4, 170122.

Also it is based to Worldclim data

    Fick, S.E. and R.J. Hijmans, 2017. WorldClim 2: new 1km spatial resolution climate surfaces for global land areas. International Journal of Climatology 37 (12): 4302-4315. 

Elevation data is derived from These were derived from the SRTM elevation data.

R code to download data

  1. chelsa cruts data download
    1. and crop by variable, year, month
    2. 2023 january

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

library(pals) ##palettes

library(RColorBrewer)

download_and_crop_dem<-function(ext1) { url1="https://biogeo.ucdavis.edu/data/worldclim/v2.1/base/wc2.1_30s_elev.zip"

#url1="https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V1/chelsa_trace/orog/CHELSA_TraCE21k_dem_1_V1.0.tif"

download.file(url = url1,destfile = 'elev.zip') unzip("elev.zip")

elev0<-raster("wc2.1_30s_elev.tif")

elev1<-crop(elev0, ext1) writeRaster(elev1 , filename="dem.nc", bandorder='BSQ',

           format="NetCDF", overwrite=TRUE)

writeRaster(elev1 , filename="dem.tif", bandorder='BSQ',

           format="GTiff", overwrite=TRUE)   
  

}

plot_precip<-function(ras1, title1) { #plot(ras1)

pal <- colorRampPalette(c("brown","yellow","green","blue"))

plot(ras1,col=pal(256), main=title1,

       xlab="longitude",
       ylab="latitude",
       sub="Precipitation mm/month %")

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)

}

download_and_crop_chelsa_cruts_precip<-function(var1, year1, month1, ext1) { url1<-paste0("https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V1/chelsa_cruts/prec/CHELSAcruts_", as.character(var1),"_",as.character(month1),"_",as.character(year1),"_V.1.0.tif")

download.file(url = url1,destfile = 'ttt.tif')

inras1<-raster("ttt.tif")

ras1<-crop(x=inras1, y=ext1)

#ras1[ras1<0]<-0 crs(ras1)<-"lonlat" return(ras1) }


    1. main program

var1="prec"

ext1 <- extent(c(xmin = -96, xmax = -85,

               ymin = 13, ymax = 22))

download_and_crop_dem(ext1)

year1=1980 month1=7

precip1<-download_and_crop_chelsa_cruts_precip(var1, year1, month1, ext1)

title1="July precip 1980"

  1. plot_precip(precip1, title1)

year1=2004 month1=7

precip2<-download_and_crop_chelsa_cruts_precip(var1, year1, month1, ext1)

title1="July precip 2004"

  1. plot_precip(precip2, title1)

deltaprecip1<-precip2-precip1

plot_precip(deltaprecip1, "Delta precip 2004-1980")

ras1<-deltaprecip1

  1. year1=2004
  2. month1=7
  1. precip2<-download_and_crop_chelsa_cruts_precip(var1, year1, month1, ext1)

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




Linux bash shell code to create mat, with gmt6 etc

    1. plot maya area aridity from external data
    2. linux gmt6 bash shell script
  1. GMT set/configuration

gmt set MAP_FRAME_TYPE plain gmt set PS_MEDIA 500x500

cdo remapbil,dem.nc deltaprecip.nc aridity3.nc

gmt grdgradient dem.nc -Ghillshade-grad.nc -A345 -Ne0.6 -V gmt grdhisteq hillshade-grad.nc -Ghillshade-hist.nc -N -V gmt grdmath hillshade-hist.nc 2 DIV = shade.nc

gmt makecpt -Cdrywet -T-200/200/10 -Z > my.cpt

gmt begin maya pdf

   gmt basemap -JM12 -R-94/-86/14/22 -Bafg   -B+t"July precipitation delta: 2004 minus 1980"
 
   gmt grdimage aridity3.nc -Cmy.cpt -Ishade.nc


   gmt coast -Df -I1/1p,blue -N1/0.25p,red,-. -I2/0.25p,blue -I3/0.15p,blue -I4/0.12p,blue  -W0.25p,blue -Slightblue
   gmt grdcontour aridity3.nc -A200+ap+f20p,0,black -C100 -t50
   #gmt psscale -Cmy.cpt -DjRM+o0.6i/0+jLM+w2.88i/0.4i+mc -I0.3 -Bx2+lTOPO -By+lkm
  gmt psscale -Cmy.cpt -B50+l"July precip. difference years 2004-1980"
  echo -89.622778 17.221944 | gmt psxy -St0.5 -Wblack -Gred  
    echo -89.622778 17.221944 "Tikal"| gmt pstext -F+f15p,1,black+a0+jTL

gmt end

pdf2svg maya.pdf maya_area_july_precipitation_difference_2004_1980_1.svg

  1. pdftoppm -png -rx 1100 -ry 1400 maya.pdf maya_july_aridity_index_2.png

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
current14:11, 8 January 2024Thumbnail for version as of 14:11, 8 January 2024496 × 576 (3.86 MB)Merikanto (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata