<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
  </head>
  <body bidimailui-charset-is-forced="true">
    <p>Hello Bakary:</p>
    <p>Please keep questions on the list, so that others can benefit
      from the conversation.</p>
    <p><br>
    </p>
    <p>I see that the Basins shapefile you sent is declared to be in
      Long/Lat WGS84 Coordinate Reference System, however the
      coordinates (the X-Y 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?</p>
    <p>(That would explain why the basins layer does not appear on your
      plot)</p>
    <p><br>
    </p>
    <p>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?</p>
    <p><br>
    </p>
    <p>Attached is the corrected script (changed to UTM28). The
      corrected basin shapefile is sent privately. (too big for the
      list)<br>
    </p>
    <p><br>
    </p>
    <p>Regards, Micha</p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 12/01/2020 21:29, Bakary Faty wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+2FMU7dDNPjdjYo-3o=OtTnXYHEe4fns+rXHRyVE=CDvsv2WQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#073763">
          <p class="MsoNormal" style="margin:0in 0in
            8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span
              style="font-family:"Times New Roman",serif"
              lang="EN-US">Dear Micha Silver</span></p>
          <p class="MsoNormal" style="margin:0in 0in
            8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span
              style="font-family:"Times New Roman",serif"
              lang="EN-US">I'm writing you this email following your
              contribution
              on my isohyet map code, in 'r-sig-geo'.</span></p>
          <p class="MsoNormal" style="margin:0in 0in
            8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span
              style="font-family:"Times New Roman",serif"
              lang="EN-US">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. </span></p>
          <p class="MsoNormal" style="margin:0in 0in
            8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span
              style="font-family:"Times New Roman",serif"
              lang="EN-US">You can see where the problem is in the code
              to make a change again?</span></p>
          <p class="MsoNormal" style="margin:0in 0in
            8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span
              style="font-family:"Times New Roman",serif"
              lang="EN-US">You will find the files of the
              watershed and my code R attached.</span></p>
          <p class="MsoNormal" style="margin:0in 0in
            8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span
              style="font-family:"Times New
              Roman",serif;font-size:11pt">Thank you very much by
              advance</span><br>
          </p>
          <p class="MsoNormal" style="margin:0in 0in
            8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span
              style="font-family:"Times New Roman",serif"
              lang="EN-US"><br>
            </span></p>
          <p class="MsoNormal" style="margin:0in 0in
            8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span
              style="font-family:"Times New Roman",serif"
              lang="EN-US">Best regards</span></p>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">Le ven. 10 janv. 2020 à 09:41,
          Micha Silver <<a href="mailto:tsvibar@gmail.com"
            moz-do-not-send="true">tsvibar@gmail.com</a>> a écrit :<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
          On 09/01/2020 21:02, Bakary Faty wrote:<br>
          > Thank you for appreciated reply,<br>
          ><br>
          > I explane you exactly what I want to do with this R code
          attached.<br>
          > I want to adapt this code to my data to build an isohyet
          map.<br>
          > But i have some difficulties to adapt it to my case.<br>
          > I will be very happy when you will help my to adapt this
          R code (attached)<br>
          > to my case.<br>
          > You can find attached the you R code and my data file.<br>
          > Best regards<br>
          ><br>
          <br>
          <br>
          I made two small changes in your code, and it works fine:<br>
          <br>
            * First I used the suggestion (earlier in this thread) to
          create your<br>
              grid.<br>
            * Then, you had an error in your call to autoKrige.<br>
            * After getting that right, I created isohyetal lines with <br>
          rasterToContour<br>
          <br>
          Here's my version<br>
          <br>
          <br>
          library(automap)<br>
          library(raster)<br>
          library(rgdal)<br>
          <br>
          ## READ INPUT FILE<br>
          rain_data <- read.csv(file="DATAFILE_FOR_ISOHYET.csv")<br>
          <br>
          point_coords <- rain_data[c("Lon","Lat")]<br>
          coordinates(rain_data) <- point_coords<br>
          p4str <- CRS("+init=epsg:4326")<br>
          proj4string(rain_data) <- p4str<br>
          <br>
          ## CONVERTION TO UTM<br>
          p4str_UTM <- CRS("+init=epsg:32633")<br>
          rain_data_UTM <- spTransform(rain_data, p4str_UTM)<br>
          <br>
          <br>
          bb <- bbox(rain_data_UTM)<br>
          minx <- bb[1,1]<br>
          maxx <- bb[1,2]<br>
          miny <- bb[2,1]<br>
          maxy <- bb[2,2]<br>
          <br>
          ## EACH PIXEL WILL BE 1000 METERS<br>
          pixel <- 1000<br>
          grd <- expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny,
          maxy, <br>
          by=pixel))<br>
          coordinates(grd) <- ~x+y<br>
          gridded(grd) <- TRUE<br>
          proj4string(grd) <- p4str_UTM<br>
          <br>
          <br>
          ## KRIGING, USING AUTOKRIGE WHICH CREATES A BEST GUESS
          VARIOGRAM<br>
          # OK_rain <- autoKrige(Rainfall_value ~ 1, rain_data_UTM,
          grd)<br>
          # There is no variable "Rainfall_value" in your data,<br>
          # It is called RAIN_DATA<br>
          OK_rain = autoKrige(formula = RAIN_DATA ~1,<br>
                               input_data = rain_data_UTM,<br>
                               new_data = grd)<br>
          <br>
          ## TRASFORM TO RASTER<br>
          rain_rast <- raster(OK_rain$krige_output)<br>
          <br>
          summary(rain_rast)<br>
          <br>
          <br>
          # Minimumn is 540, max is 1735<br>
          # So create isohyetal lines about every 100 mm and plot<br>
          <br>
          isohyets = rasterToContour(rain_rast, nlevels = 12)<br>
          plot(rain_rast)<br>
          lines(isohyets, add = TRUE)<br>
          <br>
          <br>
          > Le jeu. 9 janv. 2020 à 18:41, Bakary Faty <<a
            href="mailto:bakaryfaty@gmail.com" target="_blank"
            moz-do-not-send="true">bakaryfaty@gmail.com</a> <br>
          > <mailto:<a href="mailto:bakaryfaty@gmail.com"
            target="_blank" moz-do-not-send="true">bakaryfaty@gmail.com</a>>>
          a écrit :<br>
          ><br>
          >     Thank you for appreciated reply,<br>
          ><br>
          >     I explane you exactly what I want to do with this R
          code attached.<br>
          >     I want to adapt this code to my data to build an
          isohyet map.<br>
          >     But i have some difficulties to adapt it to my case.<br>
          >     I will be very happy when you will help my to adapt
          this R code<br>
          >     (attached)<br>
          >     to my case.<br>
          >     You can find attached the you R code, my data file
          and my sahefile<br>
          >     of watershed.<br>
          ><br>
          >     Best regards<br>
          ><br>
          ><br>
          >     Le jeu. 9 janv. 2020 à 17:47, Ben Tupper <<a
            href="mailto:btupper@bigelow.org" target="_blank"
            moz-do-not-send="true">btupper@bigelow.org</a><br>
          >     <mailto:<a href="mailto:btupper@bigelow.org"
            target="_blank" moz-do-not-send="true">btupper@bigelow.org</a>>>
          a écrit :<br>
          ><br>
          >         Welcome to r-sig-geo!<br>
          ><br>
          >         I don't think that you haven't provided us
          enough information<br>
          >         so that we can help.  On the other hand, does the
          example<br>
          >         below using expand.grid help?<br>
          ><br>
          >         minx <- 20<br>
          >         maxx <- 25<br>
          >         miny <- 31<br>
          >         maxy <- 36<br>
          >         pixel <- 1<br>
          >         grd <- expand.grid(x = seq(minx, maxx,
          by=pixel), y =<br>
          >         seq(miny, maxy, by=pixel))<br>
          ><br>
          >         Ben<br>
          ><br>
          >         On Thu, Jan 9, 2020 at 11:41 AM Bakary Faty<br>
          >         <<a href="mailto:bakaryfaty@gmail.com"
            target="_blank" moz-do-not-send="true">bakaryfaty@gmail.com</a>
          <mailto:<a href="mailto:bakaryfaty@gmail.com"
            target="_blank" moz-do-not-send="true">bakaryfaty@gmail.com</a>>>
          wrote:<br>
          ><br>
          ><br>
          >             Dear,<br>
          ><br>
          >             I'm writing to express my wish to join
          R-sig-geo list users.<br>
          >             I was doing a search on the net to know how
          to build an<br>
          >             isohyet map and I came across this R code.<br>
          >             However, I stumbled upon a problem from the
          line :<br>
          >             grd <- expand.grid(x=seq(minx, maxx,
          by=pixel),<br>
          >             y=seq(miny, maxy, by=pixel)),<br>
          >             I get the following error message:<br>
          >             default method not implemented for type 'S4'.
          I want to<br>
          >             know how resolve this error.<br>
          ><br>
          >             Also, I would like to ask you only at the
          line level:<br>
          >             minx <- rain_data_UTM at bbox[1,1]<br>
          >             maxx <- rain_data_UTM at bbox[1,2]<br>
          >             miny <- rain_data_UTM at bbox[2,1]<br>
          >             maxy <- rain_data_UTM at bbox[2,2],<br>
          >             if I should limit myself to "rain_data_UTM"
          or write<br>
          >             completely:<br>
          >             rain_data_UTM at bbox[,].<br>
          >              By the way, this is the pointfile I
          reconstructed.<br>
          >             You can find it attached to the mail.<br>
          ><br>
          >             Thanks in advance<br>
          ><br>
          >             Best regards<br>
          ><br>
          ><br>
          ><br>
          >             Bakary<br>
          >           
           _______________________________________________<br>
          >             R-sig-Geo mailing list<br>
          >             <a href="mailto:R-sig-Geo@r-project.org"
            target="_blank" moz-do-not-send="true">R-sig-Geo@r-project.org</a>
          <mailto:<a href="mailto:R-sig-Geo@r-project.org"
            target="_blank" moz-do-not-send="true">R-sig-Geo@r-project.org</a>><br>
          >             <a
            href="https://stat.ethz.ch/mailman/listinfo/r-sig-geo"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://stat.ethz.ch/mailman/listinfo/r-sig-geo</a><br>
          ><br>
          ><br>
          ><br>
          >         -- <br>
          >         Ben Tupper<br>
          >         Bigelow Laboratory for Ocean Science<br>
          >         West Boothbay Harbor, Maine<br>
          >         <a href="http://www.bigelow.org/"
            rel="noreferrer" target="_blank" moz-do-not-send="true">http://www.bigelow.org/</a><br>
          >         <a href="https://eco.bigelow.org"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://eco.bigelow.org</a><br>
          ><br>
          ><br>
          ><br>
          >     -- <br>
          ><br>
          ><br>
          ><br>
          >     Bakary<br>
          ><br>
          ><br>
          ><br>
          > -- <br>
          ><br>
          ><br>
          ><br>
          > Bakary<br>
          ><br>
          > _______________________________________________<br>
          > R-sig-Geo mailing list<br>
          > <a href="mailto:R-sig-Geo@r-project.org" target="_blank"
            moz-do-not-send="true">R-sig-Geo@r-project.org</a><br>
          > <a
            href="https://stat.ethz.ch/mailman/listinfo/r-sig-geo"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://stat.ethz.ch/mailman/listinfo/r-sig-geo</a><br>
          <br>
          -- <br>
          Micha Silver<br>
          Ben Gurion Univ.<br>
          Sde Boker, Remote Sensing Lab<br>
          cell: +972-523-665918<br>
          <a href="https://orcid.org/0000-0002-1128-1325"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://orcid.org/0000-0002-1128-1325</a><br>
          <br>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr" class="gmail_signature">
        <div dir="ltr">
          <div>
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div><font face="comic sans ms, sans-serif"
                      color="#073763"><br>
                    </font></div>
                  <font face="comic sans ms, sans-serif" color="#073763">
                    <div><span style="font-size:12.8px"><br>
                      </span></div>
                    <div><span style="font-size:12.8px"><br>
                      </span></div>
                    <div><span style="font-size:12.8px">Bakary</span><br>
                    </div>
                  </font></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Micha Silver
Ben Gurion Univ
Sde Boker, Remote Sensing Lab
+972-523-665918</pre>
  </body>
</html>