Dear list users,
I implemented a code for creation of snowfall isohyets through the inverse 
distance method applied to a Digital Elevation Model.
Within a big area (approximatively 2.000 km2) I use only six stations, I would 
expect the snowfall esteem getting smaller with higher distances from the 
stations.
In my case the snowfall values remain constant all over the area.

This is the relevant part of my code (df_prec is the data frame that contains 
the coordinates of the stations and the snowfall cumulates).
Could somebody be so patient to spot where is my (big) mistake? (Here attached 
- as exception - the file picture1.pdf is an example of the result.)

Thank you for your attention and your help
Stefano Sofia



## LOADING SHAPEFILE FOR AREA5
Shape_area <- readOGR(dsn="area.shp", layer="area")
Shape_area_projection <- "+init=epsg:32633 +proj=utm +zone=33 +datum=WGS84 
+units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"
Shape_area <- spTransform(Shape_area, CRS(Shape_area_projection))

## LOADING DEM
area_DEM raster("dem.tif")
area_DEM <- projectRaster(area_DEM, crs = CRS("+init=epsg:32633"))

## EXTRACTING THE ELEVATION VALUES TO MY POINTS
df_prec$ExtractedElevationValues <- extract(x=area_DEM, y=df_prec)

## CREATING A NEW GRID
newgrid <- as(area_DEM, "SpatialGridDataFrame")
newgrid <- raster(newgrid)
names(newgrid) <- "ExtractedElevationValues"

## Inverse Distance Weighted
if (sum(df_prec$Cumulata) > 0)
{
  OK_rain <- gstat(formula=snowfall_cumulate~ExtractedElevationValues, 
data=df_prec, locations=newgrid)
  rain_rast <- interpolate(newgrid, OK_rain, xyOnly=FALSE, na.rm=FALSE)

} else
{
  rain_rast <- raster(df_prec)*0
}




         (oo)
--oOO--( )--OOo----------------
Stefano Sofia PhD
Area Meteorologica e  Area nivologica - Centro Funzionale
Servizio Protezione Civile - Regione Marche
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona
Uff: 071 806 7743
E-mail: [email protected]
---Oo---------oO----------------

________________________________

AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere 
informazioni confidenziali, pertanto è destinato solo a persone autorizzate 
alla ricezione. I messaggi di posta elettronica per i client di Regione Marche 
possono contenere informazioni confidenziali e con privilegi legali. Se non si 
è il destinatario specificato, non leggere, copiare, inoltrare o archiviare 
questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al 
mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi 
dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed 
urgenza, la risposta al presente messaggio di posta elettronica può essere 
visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by 
persons entitled to receive the confidential information it may contain. E-mail 
messages to clients of Regione Marche may contain information that is 
confidential and legally privileged. Please do not read, copy, forward, or 
store this message unless you are an intended recipient of it. If you have 
received this message in error, please forward it to the sender and delete it 
completely from your computer system.

--
Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
This message was scanned by Libra ESVA and is believed to be clean.

Attachment: picture1.pdf
Description: picture1.pdf

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to