

Dear,
I'm writing to express my wish to join Rsiggeo list users. I was doing a search on the net to know how to build an isohyet map and I came across this R code. However, I stumbled upon a problem from the line : grd < expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy, by=pixel)), I get the following error message: default method not implemented for type 'S4'. I want to know how resolve this error.
Also, I would like to ask you only at the line level: minx < rain_data_UTM at bbox[1,1] maxx < rain_data_UTM at bbox[1,2] miny < rain_data_UTM at bbox[2,1] maxy < rain_data_UTM at bbox[2,2], if I should limit myself to "rain_data_UTM" or write completely: rain_data_UTM at bbox[,]. By the way, this is the pointfile I reconstructed. You can find it attached to the mail.
Thanks in advance
Best regards
_______________________________________________
RsigGeo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/rsiggeo


Welcome to rsiggeo!
I don't think that you haven't provided us enough information so that we
can help. On the other hand, does the example below using expand.grid help?
minx < 20
maxx < 25
miny < 31
maxy < 36
pixel < 1
grd < expand.grid(x = seq(minx, maxx, by=pixel), y = seq(miny, maxy,
by=pixel))
Ben
On Thu, Jan 9, 2020 at 11:41 AM Bakary Faty < [hidden email]> wrote:
>
> Dear,
>
> I'm writing to express my wish to join Rsiggeo list users.
> I was doing a search on the net to know how to build an isohyet map and I
> came across this R code.
> However, I stumbled upon a problem from the line :
> grd < expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy,
> by=pixel)),
> I get the following error message:
> default method not implemented for type 'S4'. I want to know how resolve
> this error.
>
> Also, I would like to ask you only at the line level:
> minx < rain_data_UTM at bbox[1,1]
> maxx < rain_data_UTM at bbox[1,2]
> miny < rain_data_UTM at bbox[2,1]
> maxy < rain_data_UTM at bbox[2,2],
> if I should limit myself to "rain_data_UTM" or write completely:
> rain_data_UTM at bbox[,].
> By the way, this is the pointfile I reconstructed.
> You can find it attached to the mail.
>
> Thanks in advance
>
> Best regards
>
>
>
> Bakary
> _______________________________________________
> RsigGeo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/rsiggeo>

Ben Tupper
Bigelow Laboratory for Ocean Science
West Boothbay Harbor, Maine
http://www.bigelow.org/https://eco.bigelow.org [[alternative HTML version deleted]]
_______________________________________________
RsigGeo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/rsiggeo


Thank you for appreciated reply,
I explane you exactly what I want to do with this R code attached. I want to adapt this code to my data to build an isohyet map. But i have some difficulties to adapt it to my case. I will be very happy when you will help my to adapt this R code (attached) to my case. You can find attached the you R code and my data file. Best regards Thank you for appreciated reply,
I explane you exactly what I want to do with this R code attached. I want to adapt this code to my data to build an isohyet map. But i have some difficulties to adapt it to my case. I will be very happy when you will help my to adapt this R code (attached) to my case. You can find attached the you R code, my data file and my sahefile of watershed.
Best regards
Welcome to rsiggeo!
I don't think that you haven't provided us enough information so that we can help. On the other hand, does the example below using expand.grid help?
minx < 20 maxx < 25 miny < 31 maxy < 36 pixel < 1 grd < expand.grid(x = seq(minx, maxx, by=pixel), y = seq(miny, maxy, by=pixel))
Ben
Dear,
I'm writing to express my wish to join Rsiggeo list users. I was doing a search on the net to know how to build an isohyet map and I came across this R code. However, I stumbled upon a problem from the line : grd < expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy, by=pixel)), I get the following error message: default method not implemented for type 'S4'. I want to know how resolve this error.
Also, I would like to ask you only at the line level: minx < rain_data_UTM at bbox[1,1] maxx < rain_data_UTM at bbox[1,2] miny < rain_data_UTM at bbox[2,1] maxy < rain_data_UTM at bbox[2,2], if I should limit myself to "rain_data_UTM" or write completely: rain_data_UTM at bbox[,]. By the way, this is the pointfile I reconstructed. You can find it attached to the mail.
Thanks in advance
Best regards
_______________________________________________
RsigGeo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/rsiggeo



_______________________________________________
RsigGeo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/rsiggeo


Your assignments that look like...
minx < rain_data_UTM at bbox[1,1]
are not valid R statements  and that will cause an error. Instead,
obtain a matrix of the bounding box using the bbox() function. Then
extract your coordinates from that. I think you want...
bb < bbox(rain_data_UTM)
minx < bb[1,1]
maxx < bb[1,2]
miny < bb[2,1]
maxy < bb[2,2]
If you haven't seen this, https://www.rspatial.org/ , it is well worth your
time. There are a lot of other great resources about using spatial data in
R. Try searching the Rseek.org. Like this
https://rseek.org/?q=spatial+tutorials It is a gold mine.
On Thu, Jan 9, 2020 at 1:42 PM Bakary Faty < [hidden email]> wrote:
> Thank you for appreciated reply,
>
> I explane you exactly what I want to do with this R code attached.
> I want to adapt this code to my data to build an isohyet map.
> But i have some difficulties to adapt it to my case.
> I will be very happy when you will help my to adapt this R code (attached)
> to my case.
> You can find attached the you R code, my data file and my sahefile of
> watershed.
>
> Best regards
>
>
> Le jeu. 9 janv. 2020 à 17:47, Ben Tupper < [hidden email]> a écrit :
>
>> Welcome to rsiggeo!
>>
>> I don't think that you haven't provided us enough information so that we
>> can help. On the other hand, does the example below using expand.grid help?
>>
>> minx < 20
>> maxx < 25
>> miny < 31
>> maxy < 36
>> pixel < 1
>> grd < expand.grid(x = seq(minx, maxx, by=pixel), y = seq(miny, maxy,
>> by=pixel))
>>
>> Ben
>>
>> On Thu, Jan 9, 2020 at 11:41 AM Bakary Faty < [hidden email]> wrote:
>>
>>>
>>> Dear,
>>>
>>> I'm writing to express my wish to join Rsiggeo list users.
>>> I was doing a search on the net to know how to build an isohyet map and
>>> I came across this R code.
>>> However, I stumbled upon a problem from the line :
>>> grd < expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy,
>>> by=pixel)),
>>> I get the following error message:
>>> default method not implemented for type 'S4'. I want to know how resolve
>>> this error.
>>>
>>> Also, I would like to ask you only at the line level:
>>> minx < rain_data_UTM at bbox[1,1]
>>> maxx < rain_data_UTM at bbox[1,2]
>>> miny < rain_data_UTM at bbox[2,1]
>>> maxy < rain_data_UTM at bbox[2,2],
>>> if I should limit myself to "rain_data_UTM" or write completely:
>>> rain_data_UTM at bbox[,].
>>> By the way, this is the pointfile I reconstructed.
>>> You can find it attached to the mail.
>>>
>>> Thanks in advance
>>>
>>> Best regards
>>>
>>>
>>>
>>> Bakary
>>> _______________________________________________
>>> RsigGeo mailing list
>>> [hidden email]
>>> https://stat.ethz.ch/mailman/listinfo/rsiggeo>>>
>>
>>
>> 
>> Ben Tupper
>> Bigelow Laboratory for Ocean Science
>> West Boothbay Harbor, Maine
>> http://www.bigelow.org/>> https://eco.bigelow.org>>
>>
>
> 
>
>
>
> Bakary
>

Ben Tupper
Bigelow Laboratory for Ocean Science
West Boothbay Harbor, Maine
http://www.bigelow.org/https://eco.bigelow.org [[alternative HTML version deleted]]
_______________________________________________
RsigGeo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/rsiggeo


Thanks very much angain,
I'll check them out.
Best regards
Le jeu. 9 janv. 2020 à 19:05, Ben Tupper < [hidden email]> a écrit :
> Your assignments that look like...
>
> minx < rain_data_UTM at bbox[1,1]
>
> are not valid R statements  and that will cause an error. Instead,
> obtain a matrix of the bounding box using the bbox() function. Then
> extract your coordinates from that. I think you want...
>
> bb < bbox(rain_data_UTM)
> minx < bb[1,1]
> maxx < bb[1,2]
> miny < bb[2,1]
> maxy < bb[2,2]
>
> If you haven't seen this, https://www.rspatial.org/ , it is well worth
> your time. There are a lot of other great resources about using spatial
> data in R. Try searching the Rseek.org. Like this
> https://rseek.org/?q=spatial+tutorials It is a gold mine.
>
>
> On Thu, Jan 9, 2020 at 1:42 PM Bakary Faty < [hidden email]> wrote:
>
>> Thank you for appreciated reply,
>>
>> I explane you exactly what I want to do with this R code attached.
>> I want to adapt this code to my data to build an isohyet map.
>> But i have some difficulties to adapt it to my case.
>> I will be very happy when you will help my to adapt this R code (attached)
>> to my case.
>> You can find attached the you R code, my data file and my sahefile of
>> watershed.
>>
>> Best regards
>>
>>
>> Le jeu. 9 janv. 2020 à 17:47, Ben Tupper < [hidden email]> a écrit :
>>
>>> Welcome to rsiggeo!
>>>
>>> I don't think that you haven't provided us enough information so that we
>>> can help. On the other hand, does the example below using expand.grid help?
>>>
>>> minx < 20
>>> maxx < 25
>>> miny < 31
>>> maxy < 36
>>> pixel < 1
>>> grd < expand.grid(x = seq(minx, maxx, by=pixel), y = seq(miny, maxy,
>>> by=pixel))
>>>
>>> Ben
>>>
>>> On Thu, Jan 9, 2020 at 11:41 AM Bakary Faty < [hidden email]>
>>> wrote:
>>>
>>>>
>>>> Dear,
>>>>
>>>> I'm writing to express my wish to join Rsiggeo list users.
>>>> I was doing a search on the net to know how to build an isohyet map and
>>>> I came across this R code.
>>>> However, I stumbled upon a problem from the line :
>>>> grd < expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy,
>>>> by=pixel)),
>>>> I get the following error message:
>>>> default method not implemented for type 'S4'. I want to know how
>>>> resolve this error.
>>>>
>>>> Also, I would like to ask you only at the line level:
>>>> minx < rain_data_UTM at bbox[1,1]
>>>> maxx < rain_data_UTM at bbox[1,2]
>>>> miny < rain_data_UTM at bbox[2,1]
>>>> maxy < rain_data_UTM at bbox[2,2],
>>>> if I should limit myself to "rain_data_UTM" or write completely:
>>>> rain_data_UTM at bbox[,].
>>>> By the way, this is the pointfile I reconstructed.
>>>> You can find it attached to the mail.
>>>>
>>>> Thanks in advance
>>>>
>>>> Best regards
>>>>
>>>>
>>>>
>>>> Bakary
>>>> _______________________________________________
>>>> RsigGeo mailing list
>>>> [hidden email]
>>>> https://stat.ethz.ch/mailman/listinfo/rsiggeo>>>>
>>>
>>>
>>> 
>>> Ben Tupper
>>> Bigelow Laboratory for Ocean Science
>>> West Boothbay Harbor, Maine
>>> http://www.bigelow.org/>>> https://eco.bigelow.org>>>
>>>
>>
>> 
>>
>>
>>
>> Bakary
>>
>
>
> 
> Ben Tupper
> Bigelow Laboratory for Ocean Science
> West Boothbay Harbor, Maine
> http://www.bigelow.org/> https://eco.bigelow.org>
>

Bakary
[[alternative HTML version deleted]]
_______________________________________________
RsigGeo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/rsiggeo

Administrator

On Thu, 9 Jan 2020, Ben Tupper wrote:
> Your assignments that look like...
>
> minx < rain_data_UTM at bbox[1,1]
>
> are not valid R statements  and that will cause an error.
I think that this might be the mail or some other system replacing
commercial at by at. Better syntax might be:
minx < slot(rain_data_UTM, "bbox")[1,1]
if this was the real intention, as slot() is the preferred scriptlevel S4
slot accessor, although one finds lots of untidy examples using
commercial at in blogs and elsewhere on the net. However, your version is
obviously much easier to read:
> Instead,
> obtain a matrix of the bounding box using the bbox() function. Then
> extract your coordinates from that. I think you want...
>
> bb < bbox(rain_data_UTM)
> minx < bb[1,1]
> maxx < bb[1,2]
> miny < bb[2,1]
> maxy < bb[2,2]
And yes, this is very good advice!
Roger
>
> If you haven't seen this, https://www.rspatial.org/ , it is well worth your
> time. There are a lot of other great resources about using spatial data in
> R. Try searching the Rseek.org. Like this
> https://rseek.org/?q=spatial+tutorials It is a gold mine.
>
>
> On Thu, Jan 9, 2020 at 1:42 PM Bakary Faty < [hidden email]> wrote:
>
>> Thank you for appreciated reply,
>>
>> I explane you exactly what I want to do with this R code attached.
>> I want to adapt this code to my data to build an isohyet map.
>> But i have some difficulties to adapt it to my case.
>> I will be very happy when you will help my to adapt this R code (attached)
>> to my case.
>> You can find attached the you R code, my data file and my sahefile of
>> watershed.
>>
>> Best regards
>>
>>
>> Le jeu. 9 janv. 2020 à 17:47, Ben Tupper < [hidden email]> a écrit :
>>
>>> Welcome to rsiggeo!
>>>
>>> I don't think that you haven't provided us enough information so that we
>>> can help. On the other hand, does the example below using expand.grid help?
>>>
>>> minx < 20
>>> maxx < 25
>>> miny < 31
>>> maxy < 36
>>> pixel < 1
>>> grd < expand.grid(x = seq(minx, maxx, by=pixel), y = seq(miny, maxy,
>>> by=pixel))
>>>
>>> Ben
>>>
>>> On Thu, Jan 9, 2020 at 11:41 AM Bakary Faty < [hidden email]> wrote:
>>>
>>>>
>>>> Dear,
>>>>
>>>> I'm writing to express my wish to join Rsiggeo list users.
>>>> I was doing a search on the net to know how to build an isohyet map and
>>>> I came across this R code.
>>>> However, I stumbled upon a problem from the line :
>>>> grd < expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy,
>>>> by=pixel)),
>>>> I get the following error message:
>>>> default method not implemented for type 'S4'. I want to know how resolve
>>>> this error.
>>>>
>>>> Also, I would like to ask you only at the line level:
>>>> minx < rain_data_UTM at bbox[1,1]
>>>> maxx < rain_data_UTM at bbox[1,2]
>>>> miny < rain_data_UTM at bbox[2,1]
>>>> maxy < rain_data_UTM at bbox[2,2],
>>>> if I should limit myself to "rain_data_UTM" or write completely:
>>>> rain_data_UTM at bbox[,].
>>>> By the way, this is the pointfile I reconstructed.
>>>> You can find it attached to the mail.
>>>>
>>>> Thanks in advance
>>>>
>>>> Best regards
>>>>
>>>>
>>>>
>>>> Bakary
>>>> _______________________________________________
>>>> RsigGeo mailing list
>>>> [hidden email]
>>>> https://stat.ethz.ch/mailman/listinfo/rsiggeo>>>>
>>>
>>>
>>> 
>>> Ben Tupper
>>> Bigelow Laboratory for Ocean Science
>>> West Boothbay Harbor, Maine
>>> http://www.bigelow.org/>>> https://eco.bigelow.org>>>
>>>
>>
>> 
>>
>>
>>
>> Bakary
>>
>
>
>

Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N5045 Bergen, Norway.
voice: +47 55 95 93 55; email: [hidden email]
https://orcid.org/0000000323926140https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en_______________________________________________
RsigGeo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/rsiggeo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N5045 Bergen, Norway


On 09/01/2020 21:02, Bakary Faty wrote:
> Thank you for appreciated reply,
>
> I explane you exactly what I want to do with this R code attached.
> I want to adapt this code to my data to build an isohyet map.
> But i have some difficulties to adapt it to my case.
> I will be very happy when you will help my to adapt this R code (attached)
> to my case.
> You can find attached the you R code and my data file.
> Best regards
>
I made two small changes in your code, and it works fine:
* First I used the suggestion (earlier in this thread) to create your
grid.
* Then, you had an error in your call to autoKrige.
* After getting that right, I created isohyetal lines with
rasterToContour
Here's my version
library(automap)
library(raster)
library(rgdal)
## READ INPUT FILE
rain_data < read.csv(file="DATAFILE_FOR_ISOHYET.csv")
point_coords < rain_data[c("Lon","Lat")]
coordinates(rain_data) < point_coords
p4str < CRS("+init=epsg:4326")
proj4string(rain_data) < p4str
## CONVERTION TO UTM
p4str_UTM < CRS("+init=epsg:32633")
rain_data_UTM < spTransform(rain_data, p4str_UTM)
bb < bbox(rain_data_UTM)
minx < bb[1,1]
maxx < bb[1,2]
miny < bb[2,1]
maxy < bb[2,2]
## EACH PIXEL WILL BE 1000 METERS
pixel < 1000
grd < expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy,
by=pixel))
coordinates(grd) < ~x+y
gridded(grd) < TRUE
proj4string(grd) < p4str_UTM
## KRIGING, USING AUTOKRIGE WHICH CREATES A BEST GUESS VARIOGRAM
# OK_rain < autoKrige(Rainfall_value ~ 1, rain_data_UTM, grd)
# There is no variable "Rainfall_value" in your data,
# It is called RAIN_DATA
OK_rain = autoKrige(formula = RAIN_DATA ~1,
input_data = rain_data_UTM,
new_data = grd)
## TRASFORM TO RASTER
rain_rast < raster(OK_rain$krige_output)
summary(rain_rast)
# Minimumn is 540, max is 1735
# So create isohyetal lines about every 100 mm and plot
isohyets = rasterToContour(rain_rast, nlevels = 12)
plot(rain_rast)
lines(isohyets, add = TRUE)
> Le jeu. 9 janv. 2020 à 18:41, Bakary Faty < [hidden email]
> <mailto: [hidden email]>> a écrit :
>
> Thank you for appreciated reply,
>
> I explane you exactly what I want to do with this R code attached.
> I want to adapt this code to my data to build an isohyet map.
> But i have some difficulties to adapt it to my case.
> I will be very happy when you will help my to adapt this R code
> (attached)
> to my case.
> You can find attached the you R code, my data file and my sahefile
> of watershed.
>
> Best regards
>
>
> Le jeu. 9 janv. 2020 à 17:47, Ben Tupper < [hidden email]
> <mailto: [hidden email]>> a écrit :
>
> Welcome to rsiggeo!
>
> I don't think that you haven't provided us enough information
> so that we can help. On the other hand, does the example
> below using expand.grid help?
>
> minx < 20
> maxx < 25
> miny < 31
> maxy < 36
> pixel < 1
> grd < expand.grid(x = seq(minx, maxx, by=pixel), y =
> seq(miny, maxy, by=pixel))
>
> Ben
>
> On Thu, Jan 9, 2020 at 11:41 AM Bakary Faty
> < [hidden email] <mailto: [hidden email]>> wrote:
>
>
> Dear,
>
> I'm writing to express my wish to join Rsiggeo list users.
> I was doing a search on the net to know how to build an
> isohyet map and I came across this R code.
> However, I stumbled upon a problem from the line :
> grd < expand.grid(x=seq(minx, maxx, by=pixel),
> y=seq(miny, maxy, by=pixel)),
> I get the following error message:
> default method not implemented for type 'S4'. I want to
> know how resolve this error.
>
> Also, I would like to ask you only at the line level:
> minx < rain_data_UTM at bbox[1,1]
> maxx < rain_data_UTM at bbox[1,2]
> miny < rain_data_UTM at bbox[2,1]
> maxy < rain_data_UTM at bbox[2,2],
> if I should limit myself to "rain_data_UTM" or write
> completely:
> rain_data_UTM at bbox[,].
> By the way, this is the pointfile I reconstructed.
> You can find it attached to the mail.
>
> Thanks in advance
>
> Best regards
>
>
>
> Bakary
> _______________________________________________
> RsigGeo mailing list
> [hidden email] <mailto: [hidden email]>
> https://stat.ethz.ch/mailman/listinfo/rsiggeo>
>
>
> 
> Ben Tupper
> Bigelow Laboratory for Ocean Science
> West Boothbay Harbor, Maine
> http://www.bigelow.org/> https://eco.bigelow.org>
>
>
> 
>
>
>
> Bakary
>
>
>
> 
>
>
>
> Bakary
>
> _______________________________________________
> RsigGeo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/rsiggeo
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972523665918
https://orcid.org/0000000211281325_______________________________________________
RsigGeo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/rsiggeo


Thank you very much for help,
The code works fine but when I add the shapefile of my watershed
I can not plot it.
Le ven. 10 janv. 2020 à 09:41, Micha Silver < [hidden email]> a écrit :
>
> On 09/01/2020 21:02, Bakary Faty wrote:
> > Thank you for appreciated reply,
> >
> > I explane you exactly what I want to do with this R code attached.
> > I want to adapt this code to my data to build an isohyet map.
> > But i have some difficulties to adapt it to my case.
> > I will be very happy when you will help my to adapt this R code
> (attached)
> > to my case.
> > You can find attached the you R code and my data file.
> > Best regards
> >
>
>
> I made two small changes in your code, and it works fine:
>
> * First I used the suggestion (earlier in this thread) to create your
> grid.
> * Then, you had an error in your call to autoKrige.
> * After getting that right, I created isohyetal lines with
> rasterToContour
>
> Here's my version
>
>
> library(automap)
> library(raster)
> library(rgdal)
>
> ## READ INPUT FILE
> rain_data < read.csv(file="DATAFILE_FOR_ISOHYET.csv")
>
> point_coords < rain_data[c("Lon","Lat")]
> coordinates(rain_data) < point_coords
> p4str < CRS("+init=epsg:4326")
> proj4string(rain_data) < p4str
>
> ## CONVERTION TO UTM
> p4str_UTM < CRS("+init=epsg:32633")
> rain_data_UTM < spTransform(rain_data, p4str_UTM)
>
>
> bb < bbox(rain_data_UTM)
> minx < bb[1,1]
> maxx < bb[1,2]
> miny < bb[2,1]
> maxy < bb[2,2]
>
> ## EACH PIXEL WILL BE 1000 METERS
> pixel < 1000
> grd < expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy,
> by=pixel))
> coordinates(grd) < ~x+y
> gridded(grd) < TRUE
> proj4string(grd) < p4str_UTM
>
>
> ## KRIGING, USING AUTOKRIGE WHICH CREATES A BEST GUESS VARIOGRAM
> # OK_rain < autoKrige(Rainfall_value ~ 1, rain_data_UTM, grd)
> # There is no variable "Rainfall_value" in your data,
> # It is called RAIN_DATA
> OK_rain = autoKrige(formula = RAIN_DATA ~1,
> input_data = rain_data_UTM,
> new_data = grd)
>
> ## TRASFORM TO RASTER
> rain_rast < raster(OK_rain$krige_output)
>
> summary(rain_rast)
>
>
> # Minimumn is 540, max is 1735
> # So create isohyetal lines about every 100 mm and plot
>
> isohyets = rasterToContour(rain_rast, nlevels = 12)
> plot(rain_rast)
> lines(isohyets, add = TRUE)
>
>
> > Le jeu. 9 janv. 2020 à 18:41, Bakary Faty < [hidden email]
> > <mailto: [hidden email]>> a écrit :
> >
> > Thank you for appreciated reply,
> >
> > I explane you exactly what I want to do with this R code attached.
> > I want to adapt this code to my data to build an isohyet map.
> > But i have some difficulties to adapt it to my case.
> > I will be very happy when you will help my to adapt this R code
> > (attached)
> > to my case.
> > You can find attached the you R code, my data file and my sahefile
> > of watershed.
> >
> > Best regards
> >
> >
> > Le jeu. 9 janv. 2020 à 17:47, Ben Tupper < [hidden email]
> > <mailto: [hidden email]>> a écrit :
> >
> > Welcome to rsiggeo!
> >
> > I don't think that you haven't provided us enough information
> > so that we can help. On the other hand, does the example
> > below using expand.grid help?
> >
> > minx < 20
> > maxx < 25
> > miny < 31
> > maxy < 36
> > pixel < 1
> > grd < expand.grid(x = seq(minx, maxx, by=pixel), y =
> > seq(miny, maxy, by=pixel))
> >
> > Ben
> >
> > On Thu, Jan 9, 2020 at 11:41 AM Bakary Faty
> > < [hidden email] <mailto: [hidden email]>> wrote:
> >
> >
> > Dear,
> >
> > I'm writing to express my wish to join Rsiggeo list users.
> > I was doing a search on the net to know how to build an
> > isohyet map and I came across this R code.
> > However, I stumbled upon a problem from the line :
> > grd < expand.grid(x=seq(minx, maxx, by=pixel),
> > y=seq(miny, maxy, by=pixel)),
> > I get the following error message:
> > default method not implemented for type 'S4'. I want to
> > know how resolve this error.
> >
> > Also, I would like to ask you only at the line level:
> > minx < rain_data_UTM at bbox[1,1]
> > maxx < rain_data_UTM at bbox[1,2]
> > miny < rain_data_UTM at bbox[2,1]
> > maxy < rain_data_UTM at bbox[2,2],
> > if I should limit myself to "rain_data_UTM" or write
> > completely:
> > rain_data_UTM at bbox[,].
> > By the way, this is the pointfile I reconstructed.
> > You can find it attached to the mail.
> >
> > Thanks in advance
> >
> > Best regards
> >
> >
> >
> > Bakary
> > _______________________________________________
> > RsigGeo mailing list
> > [hidden email] <mailto: [hidden email]>
> > https://stat.ethz.ch/mailman/listinfo/rsiggeo> >
> >
> >
> > 
> > Ben Tupper
> > Bigelow Laboratory for Ocean Science
> > West Boothbay Harbor, Maine
> > http://www.bigelow.org/> > https://eco.bigelow.org> >
> >
> >
> > 
> >
> >
> >
> > Bakary
> >
> >
> >
> > 
> >
> >
> >
> > Bakary
> >
> > _______________________________________________
> > RsigGeo mailing list
> > [hidden email]
> > https://stat.ethz.ch/mailman/listinfo/rsiggeo>
> 
> Micha Silver
> Ben Gurion Univ.
> Sde Boker, Remote Sensing Lab
> cell: +972523665918
> https://orcid.org/0000000211281325>
>

Bakary
[[alternative HTML version deleted]]
_______________________________________________
RsigGeo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/rsiggeo


Hello Bakary:
Please keep questions on the list, so that others can benefit
from the conversation.
I see that the Basins shapefile you sent is declared to be in
Long/Lat WGS84 Coordinate Reference System, however the
coordinates (the XY locations) look like it is already projected
to UTM 33. Is it possible there is some mixup in the Coordinate
Reference System of the Basins shapefile?
(That would explain why the basins layer does not appear on your
plot)
Furthermore, I think that you are working in Senegal/Gambia (from
the coordinates in the DATAFILE). If so, why did you choose to
project to UTM 33 in your script? Isn't Senegal in UTM zone 28?
Attached is the corrected script (changed to UTM28). The
corrected basin shapefile is sent privately. (too big for the
list)
Regards, Micha
On 12/01/2020 21:29, Bakary Faty wrote:
Dear Micha Silver
I'm writing you this email following your
contribution
on my isohyet map code, in 'rsiggeo'.
I really appreciated your help which helped
me a lot.
I can draw the isohyets but I can't draw the contour of my
study basin.
You can see where the problem is in the code
to make a change again?
You will find the files of the
watershed and my code R attached.
Thank you very much by
advance
Best regards
Le ven. 10 janv. 2020 à 09:41,
Micha Silver < [hidden email]> a écrit :
On 09/01/2020 21:02, Bakary Faty wrote:
> Thank you for appreciated reply,
>
> I explane you exactly what I want to do with this R code
attached.
> I want to adapt this code to my data to build an isohyet
map.
> But i have some difficulties to adapt it to my case.
> I will be very happy when you will help my to adapt this
R code (attached)
> to my case.
> You can find attached the you R code and my data file.
> Best regards
>
I made two small changes in your code, and it works fine:
* First I used the suggestion (earlier in this thread) to
create your
grid.
* Then, you had an error in your call to autoKrige.
* After getting that right, I created isohyetal lines with
rasterToContour
Here's my version
library(automap)
library(raster)
library(rgdal)
## READ INPUT FILE
rain_data < read.csv(file="DATAFILE_FOR_ISOHYET.csv")
point_coords < rain_data[c("Lon","Lat")]
coordinates(rain_data) < point_coords
p4str < CRS("+init=epsg:4326")
proj4string(rain_data) < p4str
## CONVERTION TO UTM
p4str_UTM < CRS("+init=epsg:32633")
rain_data_UTM < spTransform(rain_data, p4str_UTM)
bb < bbox(rain_data_UTM)
minx < bb[1,1]
maxx < bb[1,2]
miny < bb[2,1]
maxy < bb[2,2]
## EACH PIXEL WILL BE 1000 METERS
pixel < 1000
grd < expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny,
maxy,
by=pixel))
coordinates(grd) < ~x+y
gridded(grd) < TRUE
proj4string(grd) < p4str_UTM
## KRIGING, USING AUTOKRIGE WHICH CREATES A BEST GUESS
VARIOGRAM
# OK_rain < autoKrige(Rainfall_value ~ 1, rain_data_UTM,
grd)
# There is no variable "Rainfall_value" in your data,
# It is called RAIN_DATA
OK_rain = autoKrige(formula = RAIN_DATA ~1,
input_data = rain_data_UTM,
new_data = grd)
## TRASFORM TO RASTER
rain_rast < raster(OK_rain$krige_output)
summary(rain_rast)
# Minimumn is 540, max is 1735
# So create isohyetal lines about every 100 mm and plot
isohyets = rasterToContour(rain_rast, nlevels = 12)
plot(rain_rast)
lines(isohyets, add = TRUE)
> Le jeu. 9 janv. 2020 à 18:41, Bakary Faty <[hidden email]
> <mailto:[hidden email]>>
a écrit :
>
> Thank you for appreciated reply,
>
> I explane you exactly what I want to do with this R
code attached.
> I want to adapt this code to my data to build an
isohyet map.
> But i have some difficulties to adapt it to my case.
> I will be very happy when you will help my to adapt
this R code
> (attached)
> to my case.
> You can find attached the you R code, my data file
and my sahefile
> of watershed.
>
> Best regards
>
>
> Le jeu. 9 janv. 2020 à 17:47, Ben Tupper <[hidden email]
> <mailto:[hidden email]>>
a écrit :
>
> Welcome to rsiggeo!
>
> I don't think that you haven't provided us
enough information
> so that we can help. On the other hand, does the
example
> below using expand.grid help?
>
> minx < 20
> maxx < 25
> miny < 31
> maxy < 36
> pixel < 1
> grd < expand.grid(x = seq(minx, maxx,
by=pixel), y =
> seq(miny, maxy, by=pixel))
>
> Ben
>
> On Thu, Jan 9, 2020 at 11:41 AM Bakary Faty
> <[hidden email]
<mailto:[hidden email]>>
wrote:
>
>
> Dear,
>
> I'm writing to express my wish to join
Rsiggeo list users.
> I was doing a search on the net to know how
to build an
> isohyet map and I came across this R code.
> However, I stumbled upon a problem from the
line :
> grd < expand.grid(x=seq(minx, maxx,
by=pixel),
> y=seq(miny, maxy, by=pixel)),
> I get the following error message:
> default method not implemented for type 'S4'.
I want to
> know how resolve this error.
>
> Also, I would like to ask you only at the
line level:
> minx < rain_data_UTM at bbox[1,1]
> maxx < rain_data_UTM at bbox[1,2]
> miny < rain_data_UTM at bbox[2,1]
> maxy < rain_data_UTM at bbox[2,2],
> if I should limit myself to "rain_data_UTM"
or write
> completely:
> rain_data_UTM at bbox[,].
> By the way, this is the pointfile I
reconstructed.
> You can find it attached to the mail.
>
> Thanks in advance
>
> Best regards
>
>
>
> Bakary
>
_______________________________________________
> RsigGeo mailing list
> [hidden email]
<mailto:[hidden email]>
> https://stat.ethz.ch/mailman/listinfo/rsiggeo
>
>
>
> 
> Ben Tupper
> Bigelow Laboratory for Ocean Science
> West Boothbay Harbor, Maine
> http://www.bigelow.org/
> https://eco.bigelow.org
>
>
>
> 
>
>
>
> Bakary
>
>
>
> 
>
>
>
> Bakary
>
> _______________________________________________
> RsigGeo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/rsiggeo

Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972523665918
https://orcid.org/0000000211281325


Micha Silver
Ben Gurion Univ
Sde Boker, Remote Sensing Lab
+972523665918
_______________________________________________
RsigGeo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/rsiggeo


Dear Silver,
Thank for your help.
I think there had been a mixup in the Coordinate Rference System. When I
plot this shapefile I get
it in the UTM Coordinate.
Le Senegal is in Zone 28 North. The watershed on what I work is shared by
trois Countries (Senegal, Gambie and Guinea).
But in the choose of UTM 33 in my script is an error.
Thank very much.
Best regards
Le lun. 13 janv. 2020 à 07:22, Micha Silver < [hidden email]> a écrit :
> Hello Bakary:
>
> Please keep questions on the list, so that others can benefit from the
> conversation.
>
>
> I see that the Basins shapefile you sent is declared to be in Long/Lat
> WGS84 Coordinate Reference System, however the coordinates (the XY
> locations) look like it is already projected to UTM 33. Is it possible
> there is some mixup in the Coordinate Reference System of the Basins
> shapefile?
>
> (That would explain why the basins layer does not appear on your plot)
>
>
> Furthermore, I think that you are working in Senegal/Gambia (from the
> coordinates in the DATAFILE). If so, why did you choose to project to UTM
> 33 in your script? Isn't Senegal in UTM zone 28?
>
>
> Attached is the corrected script (changed to UTM28). The corrected basin
> shapefile is sent privately. (too big for the list)
>
>
> Regards, Micha
>
>
>
>
> On 12/01/2020 21:29, Bakary Faty wrote:
>
> Dear Micha Silver
>
> I'm writing you this email following your contribution on my isohyet map
> code, in 'rsiggeo'.
>
> I really appreciated your help which helped me a lot. I can draw the
> isohyets but I can't draw the contour of my study basin.
>
> You can see where the problem is in the code to make a change again?
>
> You will find the files of the watershed and my code R attached.
>
> Thank you very much by advance
>
>
> Best regards
>
> Le ven. 10 janv. 2020 à 09:41, Micha Silver < [hidden email]> a écrit :
>
>>
>> On 09/01/2020 21:02, Bakary Faty wrote:
>> > Thank you for appreciated reply,
>> >
>> > I explane you exactly what I want to do with this R code attached.
>> > I want to adapt this code to my data to build an isohyet map.
>> > But i have some difficulties to adapt it to my case.
>> > I will be very happy when you will help my to adapt this R code
>> (attached)
>> > to my case.
>> > You can find attached the you R code and my data file.
>> > Best regards
>> >
>>
>>
>> I made two small changes in your code, and it works fine:
>>
>> * First I used the suggestion (earlier in this thread) to create your
>> grid.
>> * Then, you had an error in your call to autoKrige.
>> * After getting that right, I created isohyetal lines with
>> rasterToContour
>>
>> Here's my version
>>
>>
>> library(automap)
>> library(raster)
>> library(rgdal)
>>
>> ## READ INPUT FILE
>> rain_data < read.csv(file="DATAFILE_FOR_ISOHYET.csv")
>>
>> point_coords < rain_data[c("Lon","Lat")]
>> coordinates(rain_data) < point_coords
>> p4str < CRS("+init=epsg:4326")
>> proj4string(rain_data) < p4str
>>
>> ## CONVERTION TO UTM
>> p4str_UTM < CRS("+init=epsg:32633")
>> rain_data_UTM < spTransform(rain_data, p4str_UTM)
>>
>>
>> bb < bbox(rain_data_UTM)
>> minx < bb[1,1]
>> maxx < bb[1,2]
>> miny < bb[2,1]
>> maxy < bb[2,2]
>>
>> ## EACH PIXEL WILL BE 1000 METERS
>> pixel < 1000
>> grd < expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy,
>> by=pixel))
>> coordinates(grd) < ~x+y
>> gridded(grd) < TRUE
>> proj4string(grd) < p4str_UTM
>>
>>
>> ## KRIGING, USING AUTOKRIGE WHICH CREATES A BEST GUESS VARIOGRAM
>> # OK_rain < autoKrige(Rainfall_value ~ 1, rain_data_UTM, grd)
>> # There is no variable "Rainfall_value" in your data,
>> # It is called RAIN_DATA
>> OK_rain = autoKrige(formula = RAIN_DATA ~1,
>> input_data = rain_data_UTM,
>> new_data = grd)
>>
>> ## TRASFORM TO RASTER
>> rain_rast < raster(OK_rain$krige_output)
>>
>> summary(rain_rast)
>>
>>
>> # Minimumn is 540, max is 1735
>> # So create isohyetal lines about every 100 mm and plot
>>
>> isohyets = rasterToContour(rain_rast, nlevels = 12)
>> plot(rain_rast)
>> lines(isohyets, add = TRUE)
>>
>>
>> > Le jeu. 9 janv. 2020 à 18:41, Bakary Faty < [hidden email]
>> > <mailto: [hidden email]>> a écrit :
>> >
>> > Thank you for appreciated reply,
>> >
>> > I explane you exactly what I want to do with this R code attached.
>> > I want to adapt this code to my data to build an isohyet map.
>> > But i have some difficulties to adapt it to my case.
>> > I will be very happy when you will help my to adapt this R code
>> > (attached)
>> > to my case.
>> > You can find attached the you R code, my data file and my sahefile
>> > of watershed.
>> >
>> > Best regards
>> >
>> >
>> > Le jeu. 9 janv. 2020 à 17:47, Ben Tupper < [hidden email]
>> > <mailto: [hidden email]>> a écrit :
>> >
>> > Welcome to rsiggeo!
>> >
>> > I don't think that you haven't provided us enough information
>> > so that we can help. On the other hand, does the example
>> > below using expand.grid help?
>> >
>> > minx < 20
>> > maxx < 25
>> > miny < 31
>> > maxy < 36
>> > pixel < 1
>> > grd < expand.grid(x = seq(minx, maxx, by=pixel), y =
>> > seq(miny, maxy, by=pixel))
>> >
>> > Ben
>> >
>> > On Thu, Jan 9, 2020 at 11:41 AM Bakary Faty
>> > < [hidden email] <mailto: [hidden email]>> wrote:
>> >
>> >
>> > Dear,
>> >
>> > I'm writing to express my wish to join Rsiggeo list users.
>> > I was doing a search on the net to know how to build an
>> > isohyet map and I came across this R code.
>> > However, I stumbled upon a problem from the line :
>> > grd < expand.grid(x=seq(minx, maxx, by=pixel),
>> > y=seq(miny, maxy, by=pixel)),
>> > I get the following error message:
>> > default method not implemented for type 'S4'. I want to
>> > know how resolve this error.
>> >
>> > Also, I would like to ask you only at the line level:
>> > minx < rain_data_UTM at bbox[1,1]
>> > maxx < rain_data_UTM at bbox[1,2]
>> > miny < rain_data_UTM at bbox[2,1]
>> > maxy < rain_data_UTM at bbox[2,2],
>> > if I should limit myself to "rain_data_UTM" or write
>> > completely:
>> > rain_data_UTM at bbox[,].
>> > By the way, this is the pointfile I reconstructed.
>> > You can find it attached to the mail.
>> >
>> > Thanks in advance
>> >
>> > Best regards
>> >
>> >
>> >
>> > Bakary
>> > _______________________________________________
>> > RsigGeo mailing list
>> > [hidden email] <mailto: [hidden email]>
>> > https://stat.ethz.ch/mailman/listinfo/rsiggeo>> >
>> >
>> >
>> > 
>> > Ben Tupper
>> > Bigelow Laboratory for Ocean Science
>> > West Boothbay Harbor, Maine
>> > http://www.bigelow.org/>> > https://eco.bigelow.org>> >
>> >
>> >
>> > 
>> >
>> >
>> >
>> > Bakary
>> >
>> >
>> >
>> > 
>> >
>> >
>> >
>> > Bakary
>> >
>> > _______________________________________________
>> > RsigGeo mailing list
>> > [hidden email]
>> > https://stat.ethz.ch/mailman/listinfo/rsiggeo>>
>> 
>> Micha Silver
>> Ben Gurion Univ.
>> Sde Boker, Remote Sensing Lab
>> cell: +972523665918
>> https://orcid.org/0000000211281325>>
>>
>
> 
>
>
>
> Bakary
>
> 
> Micha Silver
> Ben Gurion Univ
> Sde Boker, Remote Sensing Lab
> +972523665918
>
>

Bakary
[[alternative HTML version deleted]]
_______________________________________________
RsigGeo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/rsiggeo

