Calculating incoming net radiation using Google Earth Engine? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Calculating cost distance in Google Earth Engine?LinearFit with Google Earth EngineCalculating areas of different classes in Google Earth Engine?Google Earth Engine - Map.addLayerGetting image band statistics in Google Earth Engine codeTemporal segmentation algorithms using Google Earth EngineClassification of NDVI using Google Earth EngineImage Collection Statistics in Google Earth Engine?Calling Google Earth Engine scripts using Python?Using if statement in Google Earth Engine?

How do spell lists change if the party levels up without taking a long rest?

What can I do if neighbor is blocking my solar panels intentionally?

Homework question about an engine pulling a train

1960s short story making fun of James Bond-style spy fiction

Is an up-to-date browser secure on an out-of-date OS?

Button changing its text & action. Good or terrible?

how can a perfect fourth interval be considered either consonant or dissonant?

Presidential Pardon

Sort list of array linked objects by keys and values

"... to apply for a visa" or "... and applied for a visa"?

What aspect of planet Earth must be changed to prevent the industrial revolution?

Do working physicists consider Newtonian mechanics to be "falsified"?

Can withdrawing asylum be illegal?

Python - Fishing Simulator

Am I ethically obligated to go into work on an off day if the reason is sudden?

My body leaves; my core can stay

Example of compact Riemannian manifold with only one geodesic.

Could an empire control the whole planet with today's comunication methods?

Are there continuous functions who are the same in an interval but differ in at least one other point?

How do I design a circuit to convert a 100 mV and 50 Hz sine wave to a square wave?

Did the new image of black hole confirm the general theory of relativity?

Intergalactic human space ship encounters another ship, character gets shunted off beyond known universe, reality starts collapsing

Is 'stolen' appropriate word?

Was credit for the black hole image misappropriated?



Calculating incoming net radiation using Google Earth Engine?



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Calculating cost distance in Google Earth Engine?LinearFit with Google Earth EngineCalculating areas of different classes in Google Earth Engine?Google Earth Engine - Map.addLayerGetting image band statistics in Google Earth Engine codeTemporal segmentation algorithms using Google Earth EngineClassification of NDVI using Google Earth EngineImage Collection Statistics in Google Earth Engine?Calling Google Earth Engine scripts using Python?Using if statement in Google Earth Engine?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I am a beginner with GEE and I am trying to calculate the incoming net radiation for that I need the square inverse of relative earth sun distance using the expression dr = 1 + 0.033*cos(J*2*pi/365) where J is the day of year.



Can someone help me with this code?



var sequence = ee.List.sequence(1, 365);
var dr2 = sequence.divide(365).multiply(Math.PI).cos().add(1);
and alternatively I used
var addDate = function(image)
var doy = image.date().getRelative('day', 'year');
var doyBand = ee.Image.constant(doy).uint16().rename('doy');
doyBand = doyBand.updateMask(image.select('B2').mask());

return image.addBands(doyBand);
;
var image = ee.ImageCollection('LANDSAT/LT05/C01/T2')
.filterDate('1987-01-01', '1990-05-01')
.filterBounds(geometry);
var withDate = image.map(addDate);
print(withDate);
Map.addLayer(withdate);
var dr = withDate.divide(365).multiply(Math.PI).cos().add(1);









share|improve this question









New contributor




Bhumika Ojha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    1















    I am a beginner with GEE and I am trying to calculate the incoming net radiation for that I need the square inverse of relative earth sun distance using the expression dr = 1 + 0.033*cos(J*2*pi/365) where J is the day of year.



    Can someone help me with this code?



    var sequence = ee.List.sequence(1, 365);
    var dr2 = sequence.divide(365).multiply(Math.PI).cos().add(1);
    and alternatively I used
    var addDate = function(image)
    var doy = image.date().getRelative('day', 'year');
    var doyBand = ee.Image.constant(doy).uint16().rename('doy');
    doyBand = doyBand.updateMask(image.select('B2').mask());

    return image.addBands(doyBand);
    ;
    var image = ee.ImageCollection('LANDSAT/LT05/C01/T2')
    .filterDate('1987-01-01', '1990-05-01')
    .filterBounds(geometry);
    var withDate = image.map(addDate);
    print(withDate);
    Map.addLayer(withdate);
    var dr = withDate.divide(365).multiply(Math.PI).cos().add(1);









    share|improve this question









    New contributor




    Bhumika Ojha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      1












      1








      1








      I am a beginner with GEE and I am trying to calculate the incoming net radiation for that I need the square inverse of relative earth sun distance using the expression dr = 1 + 0.033*cos(J*2*pi/365) where J is the day of year.



      Can someone help me with this code?



      var sequence = ee.List.sequence(1, 365);
      var dr2 = sequence.divide(365).multiply(Math.PI).cos().add(1);
      and alternatively I used
      var addDate = function(image)
      var doy = image.date().getRelative('day', 'year');
      var doyBand = ee.Image.constant(doy).uint16().rename('doy');
      doyBand = doyBand.updateMask(image.select('B2').mask());

      return image.addBands(doyBand);
      ;
      var image = ee.ImageCollection('LANDSAT/LT05/C01/T2')
      .filterDate('1987-01-01', '1990-05-01')
      .filterBounds(geometry);
      var withDate = image.map(addDate);
      print(withDate);
      Map.addLayer(withdate);
      var dr = withDate.divide(365).multiply(Math.PI).cos().add(1);









      share|improve this question









      New contributor




      Bhumika Ojha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I am a beginner with GEE and I am trying to calculate the incoming net radiation for that I need the square inverse of relative earth sun distance using the expression dr = 1 + 0.033*cos(J*2*pi/365) where J is the day of year.



      Can someone help me with this code?



      var sequence = ee.List.sequence(1, 365);
      var dr2 = sequence.divide(365).multiply(Math.PI).cos().add(1);
      and alternatively I used
      var addDate = function(image)
      var doy = image.date().getRelative('day', 'year');
      var doyBand = ee.Image.constant(doy).uint16().rename('doy');
      doyBand = doyBand.updateMask(image.select('B2').mask());

      return image.addBands(doyBand);
      ;
      var image = ee.ImageCollection('LANDSAT/LT05/C01/T2')
      .filterDate('1987-01-01', '1990-05-01')
      .filterBounds(geometry);
      var withDate = image.map(addDate);
      print(withDate);
      Map.addLayer(withdate);
      var dr = withDate.divide(365).multiply(Math.PI).cos().add(1);






      google-earth-engine statistics






      share|improve this question









      New contributor




      Bhumika Ojha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Bhumika Ojha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Apr 7 at 7:51









      PolyGeo

      53.9k1782246




      53.9k1782246






      New contributor




      Bhumika Ojha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Apr 7 at 5:47









      Bhumika OjhaBhumika Ojha

      83




      83




      New contributor




      Bhumika Ojha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Bhumika Ojha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Bhumika Ojha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes


















          1














          You prabably want to calculate the dr on a per image basis, similar as you did for calculating the doy. That's why you will have to map over the image collection. You could add the dr function inside the function were you calculate the doy.



          As your function in the question differs from the function you typed in the code below it, I assumed you want to use this: dr = 1 + 0.033*cos(J*2*pi/365):



          // and alternatively I used 
          var addDate = function(image)

          // calculate the doy band
          var doy = image.date().getRelative('day', 'year');
          var doyBand = ee.Image.constant(doy).uint16().rename('doy');
          doyBand = doyBand.updateMask(image.select('B2').mask());

          // calculate the dr using: dr = 1 + 0.033*cos(J*2*pi/365)
          var temp = doyBand.multiply(2).multiply(Math.PI).divide(365);
          var temp2 = temp.cos();
          var dr = temp2.multiply(0.033).add(1).rename('dr');
          // add the bands to the image
          return image.addBands([doyBand, dr]);
          ;


          I wrote it down in multiple lines so you are less likely to mix up the order of the functions. Link code.



          For the list you calculated (possibly as check), you will need to cast the list to an ee.Array() to be able to do element-wise operations:



          var sequence = ee.Array(ee.List.sequence(1, 365));
          var dr2 = sequence.multiply(2).divide(365).multiply(Math.PI).cos().multiply(0.033).add(1);
          print(dr2)





          share|improve this answer

























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "79"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            Bhumika Ojha is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318013%2fcalculating-incoming-net-radiation-using-google-earth-engine%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You prabably want to calculate the dr on a per image basis, similar as you did for calculating the doy. That's why you will have to map over the image collection. You could add the dr function inside the function were you calculate the doy.



            As your function in the question differs from the function you typed in the code below it, I assumed you want to use this: dr = 1 + 0.033*cos(J*2*pi/365):



            // and alternatively I used 
            var addDate = function(image)

            // calculate the doy band
            var doy = image.date().getRelative('day', 'year');
            var doyBand = ee.Image.constant(doy).uint16().rename('doy');
            doyBand = doyBand.updateMask(image.select('B2').mask());

            // calculate the dr using: dr = 1 + 0.033*cos(J*2*pi/365)
            var temp = doyBand.multiply(2).multiply(Math.PI).divide(365);
            var temp2 = temp.cos();
            var dr = temp2.multiply(0.033).add(1).rename('dr');
            // add the bands to the image
            return image.addBands([doyBand, dr]);
            ;


            I wrote it down in multiple lines so you are less likely to mix up the order of the functions. Link code.



            For the list you calculated (possibly as check), you will need to cast the list to an ee.Array() to be able to do element-wise operations:



            var sequence = ee.Array(ee.List.sequence(1, 365));
            var dr2 = sequence.multiply(2).divide(365).multiply(Math.PI).cos().multiply(0.033).add(1);
            print(dr2)





            share|improve this answer





























              1














              You prabably want to calculate the dr on a per image basis, similar as you did for calculating the doy. That's why you will have to map over the image collection. You could add the dr function inside the function were you calculate the doy.



              As your function in the question differs from the function you typed in the code below it, I assumed you want to use this: dr = 1 + 0.033*cos(J*2*pi/365):



              // and alternatively I used 
              var addDate = function(image)

              // calculate the doy band
              var doy = image.date().getRelative('day', 'year');
              var doyBand = ee.Image.constant(doy).uint16().rename('doy');
              doyBand = doyBand.updateMask(image.select('B2').mask());

              // calculate the dr using: dr = 1 + 0.033*cos(J*2*pi/365)
              var temp = doyBand.multiply(2).multiply(Math.PI).divide(365);
              var temp2 = temp.cos();
              var dr = temp2.multiply(0.033).add(1).rename('dr');
              // add the bands to the image
              return image.addBands([doyBand, dr]);
              ;


              I wrote it down in multiple lines so you are less likely to mix up the order of the functions. Link code.



              For the list you calculated (possibly as check), you will need to cast the list to an ee.Array() to be able to do element-wise operations:



              var sequence = ee.Array(ee.List.sequence(1, 365));
              var dr2 = sequence.multiply(2).divide(365).multiply(Math.PI).cos().multiply(0.033).add(1);
              print(dr2)





              share|improve this answer



























                1












                1








                1







                You prabably want to calculate the dr on a per image basis, similar as you did for calculating the doy. That's why you will have to map over the image collection. You could add the dr function inside the function were you calculate the doy.



                As your function in the question differs from the function you typed in the code below it, I assumed you want to use this: dr = 1 + 0.033*cos(J*2*pi/365):



                // and alternatively I used 
                var addDate = function(image)

                // calculate the doy band
                var doy = image.date().getRelative('day', 'year');
                var doyBand = ee.Image.constant(doy).uint16().rename('doy');
                doyBand = doyBand.updateMask(image.select('B2').mask());

                // calculate the dr using: dr = 1 + 0.033*cos(J*2*pi/365)
                var temp = doyBand.multiply(2).multiply(Math.PI).divide(365);
                var temp2 = temp.cos();
                var dr = temp2.multiply(0.033).add(1).rename('dr');
                // add the bands to the image
                return image.addBands([doyBand, dr]);
                ;


                I wrote it down in multiple lines so you are less likely to mix up the order of the functions. Link code.



                For the list you calculated (possibly as check), you will need to cast the list to an ee.Array() to be able to do element-wise operations:



                var sequence = ee.Array(ee.List.sequence(1, 365));
                var dr2 = sequence.multiply(2).divide(365).multiply(Math.PI).cos().multiply(0.033).add(1);
                print(dr2)





                share|improve this answer















                You prabably want to calculate the dr on a per image basis, similar as you did for calculating the doy. That's why you will have to map over the image collection. You could add the dr function inside the function were you calculate the doy.



                As your function in the question differs from the function you typed in the code below it, I assumed you want to use this: dr = 1 + 0.033*cos(J*2*pi/365):



                // and alternatively I used 
                var addDate = function(image)

                // calculate the doy band
                var doy = image.date().getRelative('day', 'year');
                var doyBand = ee.Image.constant(doy).uint16().rename('doy');
                doyBand = doyBand.updateMask(image.select('B2').mask());

                // calculate the dr using: dr = 1 + 0.033*cos(J*2*pi/365)
                var temp = doyBand.multiply(2).multiply(Math.PI).divide(365);
                var temp2 = temp.cos();
                var dr = temp2.multiply(0.033).add(1).rename('dr');
                // add the bands to the image
                return image.addBands([doyBand, dr]);
                ;


                I wrote it down in multiple lines so you are less likely to mix up the order of the functions. Link code.



                For the list you calculated (possibly as check), you will need to cast the list to an ee.Array() to be able to do element-wise operations:



                var sequence = ee.Array(ee.List.sequence(1, 365));
                var dr2 = sequence.multiply(2).divide(365).multiply(Math.PI).cos().multiply(0.033).add(1);
                print(dr2)






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 7 at 8:48

























                answered Apr 7 at 8:43









                KuikKuik

                2,4521214




                2,4521214




















                    Bhumika Ojha is a new contributor. Be nice, and check out our Code of Conduct.









                    draft saved

                    draft discarded


















                    Bhumika Ojha is a new contributor. Be nice, and check out our Code of Conduct.












                    Bhumika Ojha is a new contributor. Be nice, and check out our Code of Conduct.











                    Bhumika Ojha is a new contributor. Be nice, and check out our Code of Conduct.














                    Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318013%2fcalculating-incoming-net-radiation-using-google-earth-engine%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

                    រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

                    Ромео және Джульетта Мазмұны Қысқаша сипаттамасы Кейіпкерлері Кино Дереккөздер Бағыттау мәзірі