Do L2 SNPP SST data have a flag to distinguish day/night SST?

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
jianke
Posts: 14
Joined: Wed Jan 15, 2014 1:36 pm America/New_York
Answers: 0

Do L2 SNPP SST data have a flag to distinguish day/night SST?

by jianke » Fri Sep 08, 2017 10:58 am America/New_York

Hi,
I wonder if L2 SNPP SST data have a flag to distinguish day/night SST. I don't see it in "flags_sst" or "l2_flags".

Thanks,
Jianke

Filters:

OB SeaDAS - dshea
Subject Matter Expert
Subject Matter Expert
Posts: 271
Joined: Thu Mar 05, 2009 10:25 am America/New_York
Answers: 0
Been thanked: 2 times

Do L2 SNPP SST data have a flag to distinguish day/night SST?

by OB SeaDAS - dshea » Fri Sep 08, 2017 12:55 pm America/New_York

Every L2 file has a global attribute "day_night_flag".  It is a string and has Day, Night, Mixed, or Unknown stored in it.  It that what you are looking for?

don

jianke
Posts: 14
Joined: Wed Jan 15, 2014 1:36 pm America/New_York
Answers: 0

Do L2 SNPP SST data have a flag to distinguish day/night SST?

by jianke » Fri Sep 08, 2017 1:11 pm America/New_York

Don,

Thanks for the response. Does this mean all the the values in one granule file share the same Day, Night, or Mixed flag? Is there a pixel pinpointed day/night flag in the data?

Also does "Mixed" mean part of the data are night time and part of them are day time, but we don't know which part is day or night?
Jianke

OB WebDev - norman
Subject Matter Expert
Subject Matter Expert
Posts: 147
Joined: Tue Feb 09, 2021 8:19 am America/New_York
Answers: 0

Do L2 SNPP SST data have a flag to distinguish day/night SST?

by OB WebDev - norman » Fri Sep 08, 2017 4:56 pm America/New_York

Hi Jianke,

Yes, "Mixed" means that the scene spans the day/night terminator.

When I need to know the day/night status of a single pixel, I compare
the pixel's position vector with the solar position vector like this.

    /* Get the solar position vector. */
    l_sun(year, dayOfYear, secondOfDay, sv, &sundist);

    for(p=0; p<wid; p++){
      float     pv[3];
      double    coslat = cos(lat[s][p] * PI/180);

      pv[0] = coslat * cos(lon[s][p] * PI/180);
      pv[1] = coslat * sin(lon[s][p] * PI/180);
      pv[2] =          sin(lat[s][p] * PI/180);

      if(pv[0]*sv[0] + pv[1]*sv[1] + pv[2]*sv[2] > 0){
        /*
        If the dot product of the sun vector and the pixel
        vector is greater than zero (i.e. the angle between
        the two vectors is less than 90 degrees) then the
        pixel is on the day side of the planet.
        */
        day++;
      }
      else{
        night++;
      }
    }

The code for the l_sun function is attached.  You pass it the time
of the scan line containing the pixel of interest.

Some assembly is required, but I'm passing this along since the weekend
is here and other responses may not be forthcoming until the new week.

Regards,
Norman
attachment 1

attachment 2

attachment 3

attachment 4

attachment 5

attachment 6

attachment 7

jianke
Posts: 14
Joined: Wed Jan 15, 2014 1:36 pm America/New_York
Answers: 0

Do L2 SNPP SST data have a flag to distinguish day/night SST?

by jianke » Mon Sep 11, 2017 9:58 am America/New_York

Hi Norman,

Thanks for the detailed information. Very helpful. I wonder if NASA has any plan to add pixelwise day/night flag in the future. I know this is important to some users.

Jianke

OB SeaDAS - dshea
Subject Matter Expert
Subject Matter Expert
Posts: 271
Joined: Thu Mar 05, 2009 10:25 am America/New_York
Answers: 0
Been thanked: 2 times

Do L2 SNPP SST data have a flag to distinguish day/night SST?

by OB SeaDAS - dshea » Mon Sep 11, 2017 10:22 am America/New_York

If you want to get per pixel day/night information, run l2gen and add "solz" to the product output list.  Then you will have a per pixel solz.  If solz > 90, you have a nighttime pixel.

don

OB.DAACx - SeanBailey
Posts: 1519
Joined: Wed Sep 18, 2019 6:15 pm America/New_York
Answers: 1
Been thanked: 9 times

Do L2 SNPP SST data have a flag to distinguish day/night SST?

by OB.DAACx - SeanBailey » Mon Sep 11, 2017 11:59 am America/New_York

For SST, the HISOLZEN flag bit of the l2_flags is set for solz > 90.  So, if you are looking at SST products, you simply need to check the l2_flags to determine if the pixel is day or night.  For ocean color products the HISOLZEN flag bit is set for solz > 70, so for those you would need to rerun outputting solz as a product or set sunzen=90.0.

Sean

jianke
Posts: 14
Joined: Wed Jan 15, 2014 1:36 pm America/New_York
Answers: 0

Do L2 SNPP SST data have a flag to distinguish day/night SST?

by jianke » Mon Sep 11, 2017 2:33 pm America/New_York

Don and Sean,

Thanks for the response, I really appreciate it. So if I use this command line

index=bitand(l2_flags,flag_Hisolzen)/flag_Hisolzen

Then index == 1 would mean nighttime, and index ==0 would mean daytime, is that right?

OB.DAACx - SeanBailey
Posts: 1519
Joined: Wed Sep 18, 2019 6:15 pm America/New_York
Answers: 1
Been thanked: 9 times

Do L2 SNPP SST data have a flag to distinguish day/night SST?

by OB.DAACx - SeanBailey » Mon Sep 11, 2017 2:44 pm America/New_York

Yep.

jianke
Posts: 14
Joined: Wed Jan 15, 2014 1:36 pm America/New_York
Answers: 0

Do L2 SNPP SST data have a flag to distinguish day/night SST?

by jianke » Mon Sep 11, 2017 2:54 pm America/New_York

Great. Thanks for all the help. I really appreciate it.

Best wishes,
Jianke

Post Reply