File:Mesa verde winter precipitation index 800 1500 ad 1.svg
Original file (SVG file, nominally 1,800 × 720 pixels, file size: 93 KB)
Captions
Summary
[edit]DescriptionMesa verde winter precipitation index 800 1500 ad 1.svg |
English: Mesa Verde winter precipitation index 800 - 1500 AD |
Date | |
Source | Own work |
Author | Merikanto |
This plot is based on North American Seasonal Precipitation Atlas (NASPA)
David W. Stahle, Edward R. Cook, Dorian J. Burnette, Max C. A. Torbenson, Ian M. Howard, Daniel Griffin, Jose Villanueva Diaz, Benjamin I. Cook, A. Park Williams, Emma Watson, David J. Sauchyn, Neil Pederson, Connie A. Woodhouse, Gregory T. Pederson, David Meko, Bethany Coulthard, Christopher J. Crawford. 2020. Dynamics, Variability, and Change in Seasonal Precipitation Reconstructions for North America. Journal of Climate, 33, 3173-3195. doi: 10.1175/JCLI-D-19-0270.1
https://www.ncei.noaa.gov/access/paleo-search/study/29372
"R" code
- 3
-
- north american paleo precipitation atlas naspa data extracting and viewing
- "R" code
-
library(raster)
library(terra)
library(ncdf4)
library(ggplot2)
library(pals)
library(zoo)
download_data=0
yeara=800
yearb=1500
year1=1200
- Cahokia
- sitename="Cahokia"
- sitee_lat=38.654722
- sitee_lon=-90.059444
- chichen itza
- sitename="Chichén Itzá"
- sitee_lat=20.684167
- sitee_lon =-88.567778
- copan NOK
- sitename="Copán"
- sitee_lat = 14.838139
- sitee_lon = -89.142222
- chaco
- sitename="Chaco Canyon"
- sitee_lat=36.058333
- sitee_lon =-107.958889
- sitename="Mexico City"
- sitee_lat=19.433333
- sitee_lon=-99.133333
- mesa verde
sitename="Mesa Verde"
sitee_lon =-108.488611
sitee_lat =37.183889
- los angeles
- sitename="Los Angeles"
- sitee_lon <- -118.25
- sitee_lat <- 34.05
- sitee_lon <- -80
- sitee_lat <- 40
iname1<-"NASPA_WARM_SPI.nc"
iname2<-"NASPA_COOL_SPI.nc"
- summer
- winter
if(download_data==1)
{
download.file(url = url1,destfile = iname1)
download.file(url = url2,destfile = iname2)
}
ncin1<- nc_open(iname1)
lon <- ncvar_get(ncin1, "lon")
lat <- ncvar_get(ncin1, "lat")
t <- ncvar_get(ncin1, "time")
pdsi0 <- ncvar_get(ncin1, "SPI")
- print(t)
- stop(-1)
nc_close(ncin1)
- dim(pdsi0)
numu1=which(t==year1)
print(numu1)
print (dim(pdsi0))
- stop(-1)
pdsi1 <- pdsi0[numu1,,]
- image(pdsi1)
r1 <- raster(pdsi1, xmn=min(lon), xmx=max(lon), ymn=min(lat), ymx=max(lat), crs=CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs+ towgs84=0,0,0"))
print("s")
r1<-flip(r1)
print("s2")
s2<-raster(nrows=200, ncols=200)
crs(s2)<-crs(r1)
extent(s2)<-extent(r1)
- r2<-resample(r1, s2)
- writeRaster(r1 , filename="pdsi.nc", bandorder='BSQ',format="NetCDF", overwrite=TRUE)
- quit(-1)
- r1 <- flip(r1, direction='y')
plot(r1, col=rev(parula(64)))
- quit(-1)
print( dim(pdsi0))
- pdsix0=as.matrix(pdsi0)
- print( dim( t(pdsix0)))
- quit(-1)
pdsix0<- aperm(pdsi0, c(3,2,1))
print( dim(pdsix0))
r_brick <- brick(pdsix0, xmn=min(lat), xmx=max(lat), ymn=min(lon), ymx=max(lon), crs=CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs+ towgs84=0,0,0"))
str(r_brick)
- quit(-1)
- print( dim( t(pdsi0)))
r_brick <- flip(t(r_brick), direction='y')
pdsi_series <- extract(r_brick, SpatialPoints(cbind(sitee_lon,sitee_lat)), method='simple')
print(pdsi_series)
- quit(-1)
print("pazka")
selyears2=seq(from=yeara, to=yearb, by=1)
- selitems2<-2005-selyears2
selitems2=selyears2
pdsis2=t(pdsi_series[yeara:yearb])
- sitee_lat
- print(selyears2)
- print(selitems2)
- print(pdsis2)
x=selyears2
y=pdsis2
df2<-data.frame(cbind(x,y))
names(df2)<-c("x", "y")
fit1 <- smooth.spline(x, y, all.knots=F, nknots=501)
- valu2= predict(loess(y ~ x))
- valu2<-filter(df2, filter = rep(1/3, 3), method = 'convolution', sides = 1)
- valu2<-rollmean(df2, 3,fill = list(NA, NULL, NA))
valu2<-rollmean(zoo(y,x), 3,fill = list(NA, NULL, NA))
print(head(valu2))
- str(valu2)
- stop(-1)
- dev.new(width = 1200, height = 600, unit = "px")
title1=paste0("Summer precipitation index SPI at ", sitename)
title2=paste0("Winter precipitation index SPI at ", sitename)
pdf(file = paste0("out.pdf"), width = 20, height = 8, colormodel = "rgb")
plot(x, y, type="l", lwd=2, col="red", lty=1,
main=title1,
xlab="Year AD",
ylab="SPI",
cex.lab=2, cex.axis=1.5, cex.main=2, cex.sub=1.5
,xaxt="n"
)
axis(1, at = seq(yeara, yearb, by = 50), cex.axis=1.5)
grid(nx = NULL, ny = NULL,
lty = 2, # Grid line type
col = "gray", # Grid line color
lwd = 1)
lines(x,y , col="#3f0000", lwd=5,add=T)
- Add the smooth curve to the plot
lines(fit1, col = "blue", lwd = 2)
- lines(valu2, col = "blue", lwd = 2 )
- axis(1, xaxp=c(700, 1800, 19), las=2)
- lines(x,y,col = "red",lwd = 4, add=T)
dev.off()
system("pdf2svg out.pdf out.svg")
print(".")
quit("yes")
Licensing
[edit]- 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/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 13:12, 10 January 2024 | 1,800 × 720 (93 KB) | Merikanto (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Width | 1440pt |
---|---|
Height | 576pt |