Google Earth Engine 3: Calculating with Images

Поделиться
HTML-код
  • Опубликовано: 9 янв 2025

Комментарии • 59

  • @heinrichkreuser9984
    @heinrichkreuser9984 4 года назад +24

    For those having the "NIR.subtract" error, just checkout 2:23 to 2:25 in x0.25 speed. He adds .first() to the end of the line. So then the full code for the first line should be:
    var image = L8.filterBounds(ee.Geometry.Point(-4, 56.9)).filterMetadata('CLOUD_COVER', 'less_than', 1).first()

    • @ProgramSam
      @ProgramSam  4 года назад +1

      Indeed, since the subtract function is meant to operate between images, passing a imageCollection into the function will throw an error. The .first() function is meant to take the first image of the collection. Another way to aggregate to collection to one image could be to take the mean, max, or min values.

    • @zainabadamu968
      @zainabadamu968 4 года назад

      Thanks a lot guys... I had an issue earlier trying to combine two images to perform the NDVI analysis and it was returning one image as the result... I just used the "mean" function and it returned both images... Thanks

    • @mahermohaisen6302
      @mahermohaisen6302 Год назад

      @@ProgramSam What if i have specific image?

  • @ramdhannypratama4669
    @ramdhannypratama4669 Год назад +2

    This is the best GEE tutorial on the internet so far! I really appreciate your work, It's really well explained.. Thanks a lot sam!

    • @ProgramSam
      @ProgramSam  Год назад

      I love to hear that! Thank you 🤗

  • @建明徐-c4e
    @建明徐-c4e Год назад +1

    This is an excellent tutorial! I highly appreciate your effort in sharing these experiences, which substantially diminish my challenges in learning GEE. Thank you!

    • @ProgramSam
      @ProgramSam  Год назад

      Thank you! It brings me joy to hear that 😊

  • @zainabkhan2475
    @zainabkhan2475 4 года назад +3

    Thank u so much for this series! regards from India :)

  • @Chranny
    @Chranny Год назад +1

    Oh yeah, plz do not stop this amazing work, super usefull!

    • @ProgramSam
      @ProgramSam  Год назад

      Thanks! I'm glad you find it useful :D

  • @sumaiyasiddique6658
    @sumaiyasiddique6658 4 года назад +2

    Hi, I understood the image filter properly. My question is how to export a series of images between a range of times, not the median image. I mean how can I get all images from 2017-01-01 to 2017-12-31?

  • @RaghebKamalMohammad
    @RaghebKamalMohammad 5 месяцев назад

    great tutorials sir 😀

  • @luisaevangelistasantos6798
    @luisaevangelistasantos6798 5 лет назад +1

    I have a question that is not really related to this particular video...
    I want to calculate the reflectance of all bands in a specific point, using landsat8...
    Is that possible?
    Thanks!

  • @sreerags5818
    @sreerags5818 4 года назад +1

    i can't perform subtract. How to convert ee.ImageCollection to a ee.Image object? Kindly help. I filtered based on specificity and all. But nothing works

    • @ProgramSam
      @ProgramSam  4 года назад +1

      That is indeed a common issue. Even if there is only one image in the image collection, it is still considered a collection (of one image). If you want to convert it, you need some sort of aggregation function. You could do collection.first() to get the first image of your collection. Other options I use often are collection.min(), collection.max(), collection.mean() or collection.median() if the collection has many images and you want to aggregate them into one image, these do the trick. Min() will take the smallest pixel value for each pixel, mean() will calculate the average pixel value of all images in the collection and so on. These functions return an ee.Image that you can use to substract.

  • @raghul7291
    @raghul7291 2 года назад

    Hello sir,
    Can you tell me How to Add Map Scale On Google Earth Engine. And Also North Line

  • @jshafiee88
    @jshafiee88 3 года назад +1

    Dear Sam,
    I wanted to convert the NEX-GDDP temperature data from Kelvin to Celsius, but the code below did not work. I watched your third and fourth videos but still have a problem. Can you help me?
    Code:
    var dataset = ee.ImageCollection('NASA/NEX-GDDP')
    .filter(ee.Filter.date('2018-07-01', '2018-07-02'));
    var minimumAirTemperature = dataset.select('tasmin');
    var tminnew = dataset.expression(
    'tmin-273.15',
    {
    'tmin': minimumAirTemperature
    })
    Map.addLayer(
    tminnew, minimumAirTemperatureVis, 'Minimum Air Temperature');
    Regards,
    Javad

    • @ProgramSam
      @ProgramSam  3 года назад

      Hi Javad!
      I think I see what's happening here. you filter your image collection by date. and this gives you a new imageCollection with less images. The expression function however, can only be executed on an Image, not an entire collection. What you are doing is running the expression function on the collection, but then it gives the error that dataset.expression is not a function. What you should do is turn your imageCollection into an image. It goes by fast, but in my video, I add .first() to my collection. this just takes the first image that is in my collection. the variable I end up with then is no longer a collection of images but just a single image. you could also use for example the mean(), max(), min() function to get one image from your filtered collection.
      Let me know if it works!

  • @coolflippers
    @coolflippers 2 года назад

    best vids thus far

    • @ProgramSam
      @ProgramSam  2 года назад

      thank you for the feedback!

  • @hamedetezadi9411
    @hamedetezadi9411 5 месяцев назад

    what is the difference between B and b here and how you chose b? you changed it in the video when it gave error without explanation

    • @ProgramSam
      @ProgramSam  5 месяцев назад

      at what timestamp did I do that? Can't find exactly what you are mentioning

  • @farizanhashfi9544
    @farizanhashfi9544 4 года назад

    does anyone know how to do logarithm calculation in GEE? im trying to do image expression/function for TSS. i'm struggling with logarithm and this "image.expression is not a function". does anyone know the solution? thank you

  • @pingkanmayestika7487
    @pingkanmayestika7487 5 лет назад

    hi!
    I want to display the TSS calculation results with colors in the range, for example TSS 0-10 m / L in yellow. Is that possible?
    thanks for your sharing

    • @ProgramSam
      @ProgramSam  5 лет назад

      It is not possible to display a range of values in a certain color although that would be a great addition. There is also no direct function to turn value ranges into classes. But with a bit of creativity it is possible to classify value ranges as shown in this stackexchange: gis.stackexchange.com/questions/264000/reclassifying-raster-values-in-google-earth-engine/264004
      After this you could give each created class a chosen color. Let me know if it works out!

  • @sudhakarmodugu3086
    @sudhakarmodugu3086 2 года назад

    tq for tutoring to us. I love your way of teaching. when i running the code I got this error pls guidance in this regard.

    • @sudhakarmodugu3086
      @sudhakarmodugu3086 2 года назад

      drive.google.com/file/d/1wNyiP3OQmrGNCajfXOBn7mBm76ZbfI45/view?usp=sharing

  • @delicktang5572
    @delicktang5572 6 лет назад

    This tutorial helps me a lot, but I still come across a problem. When I finish the code, the console says 'image.expression is not a function'. What's going wrong?

    • @ProgramSam
      @ProgramSam  6 лет назад +1

      The 'expression' function is used only for ee.Image objects. I Think your variable might not be such an object, so expression would not be a valid function. Could it be you still have an imageCollection object? when you print the variable, as in print(image), the variable type will appear briefly before printing the result. You might want to check that out first ;)

    • @delicktang5572
      @delicktang5572 6 лет назад

      Yes, it's still imageCollection object.
      var image = S2.filterBounds(Region).filterMetadata('CLOUD_COVERAGE_ASSESSMENT', 'less_than', 20).filterDate('2017-01-01','2018-08-31');
      This line of code produces an ImageCollection COPERNICUS/S2 (84 elements). But I don't know how to convert it to ee.Image object.

    • @ProgramSam
      @ProgramSam  6 лет назад

      Okey so you now have a collection of 84 elements (images) that fit your requirements, but you only want one image. You could do image.first(). This will select the first image of your collection. Or you could do image.median(), which will take the median image of all 84. Both of these operations will give you an ee.Image as result in stead of ImageCollection.
      There are other functions as well, such as .average(), .min() to take the lowest values, .max() to take the highest values and so on, but I think .first() or .median() will suit you best!

    • @delicktang5572
      @delicktang5572 6 лет назад

      Problem solved. Thanks a lot.
      So the key is to use only one single image when using expressions.

    • @ProgramSam
      @ProgramSam  6 лет назад

      exactly! The expression function can only be used on a single image not on a collection, glad I could help. FYI, the next video will be about how to map functions over entire collections

  • @hungnguyenphi4552
    @hungnguyenphi4552 5 лет назад

    when i run the code, the console says "NIR.subtract is not function', help me out please.

    • @ProgramSam
      @ProgramSam  5 лет назад

      the subtract function is a function for images only. So I suspect that your NIR is not an image object. Could it be that it is still an image collection (maybe of just one image)? You can turn this into an image by doing NIR.first() for example, which selects the first item in an image collection. Let me know if it works!

    • @hungnguyenphi4552
      @hungnguyenphi4552 5 лет назад

      @@ProgramSam var image= imageCollection.filterBounds(ee.Geometry.Point(106.6880844,10.8007089)).filterMetadata('CLOUD_COVER','less_than',1);
      var RED = image.select('B4');
      var NIR = image.select('B5');
      var NDVI = NIR.subtract(RED).divide(NIR.add(RED));
      Map.addLayer(NDVI)
      these are my codes

    • @samvanemelen6316
      @samvanemelen6316 5 лет назад +1

      @@hungnguyenphi4552 Well it is indeed as I mentioned. You filter an image collection, which returns a new image collection. Then the select function selects the band in all the images of the collection, which still is a valid function. But then you subtract the two image collections. This something that does not work. you can only subtract and add images.

    • @yogeshregmi1593
      @yogeshregmi1593 4 года назад

      @@hungnguyenphi4552 had you solve this problem ?

    • @heinrichkreuser9984
      @heinrichkreuser9984 4 года назад +2

      Hey guys, I believe the problem was that you guys didn't seehim add '.first()' to the end of his first line (checkout 2:23 - 2:25 in slow motion)

  • @carloshumbertooviedosanabr6730
    @carloshumbertooviedosanabr6730 4 года назад

    Hi Sam,
    Congratulations of your work in this topic, it's very important for other persons what wish initializated with tool.
    I want know how can multiplicate value of imagery for number integer, this intention is for change the units in the products of Google Earth Engine, for example;
    I have return of process in GEE 0.0005 and i need this value look in 5. Please, help me.
    PD: Excuse me for my Writing, I'm Spanish speaker.

    • @ProgramSam
      @ProgramSam  4 года назад

      Hi Carlos, thanks for your feedback! I totally get what you mean and that is indeed possible. Since images are GEE objects, you need to multiply them with a GEE number object. JavaScript won't understand when you try to multiply an object with a number. So what you should do is: image.multiply(ee.Number(10000)) in your case.

    • @_nandakishore
      @_nandakishore 2 года назад

      @@ProgramSam error: Image.select: Parameter 'input' is required.I am having this error. How to coorect it? pls explain

  • @НикитаБабарыкин-р1ь

    Best of the best

  • @RohitKumar-is1by
    @RohitKumar-is1by 4 года назад +1

    why B4 =red and B5 = NIR

    • @ProgramSam
      @ProgramSam  4 года назад

      It is in the documentation of this specific image source. Each band corresponds to a certain range of wavelengths, and these happen to be named b4 and b5 for red and nir in this dataset

  • @mc8471
    @mc8471 3 года назад +1

    I once saw these videos on bilibili,but I'm for the origin resource。

    • @ProgramSam
      @ProgramSam  3 года назад

      Thanks for letting me know, where they my videos on bilibili? And if so, could you share the link with me?

    • @mc8471
      @mc8471 3 года назад +1

      @@ProgramSam If you post the video to bilibili, you will get a lot of fans. Because China has a large number of students who want to see the GEE tutorial.

    • @mc8471
      @mc8471 3 года назад

      @@ProgramSam Sending links in the comments will be blocked. If you really want to know, you can leave your gmail or outlook account and I will email it to you.

    • @ProgramSam
      @ProgramSam  3 года назад +1

      @@mc8471 Thanks, I have found the videos. I would love to reach more people, but sadly bilibili is chinese only, and that's a language I haven't mastered yet 😉. I'll see if I can contact the uploader. Not that I don't want my videos to be on the site, I just don't reallyappreciate it being uploaded without ever being contacted or properly referenced 👍.

  • @Jonathanlopez-kl1ob
    @Jonathanlopez-kl1ob 5 лет назад

    Not a good video NIR.subtract error. I don’t know any coding show how to make single image

    • @ProgramSam
      @ProgramSam  5 лет назад +1

      If you want an introduction on how to show images, check out the video about filtering and displaying images first: ruclips.net/video/4w6Mt6HTC2I/видео.html
      It was never my intention to teach people Javascript, there are already plenty of tutorials about that programming language online, but thanks for your feedback!

    • @sreerags5818
      @sreerags5818 4 года назад

      @@ProgramSam Still it doesn't work. Mine is the exact same code of your's.