Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about input data for IOP model(QAA and GIOP) #3

Open
jiwoni-ind opened this issue Oct 8, 2021 · 5 comments
Open

about input data for IOP model(QAA and GIOP) #3

jiwoni-ind opened this issue Oct 8, 2021 · 5 comments

Comments

@jiwoni-ind
Copy link

jiwoni-ind commented Oct 8, 2021

Hi, Smith

Thank you for sharing the source code for IOP algorithms(QAA and GIOP).
This is very useful for using sensor data not provided by OCSSW.

I have one question for using this.
First of all, I want to use this calculate IOP using remote sensing reflectance from GOCI-II.
However, I keep getting various errors.

So I'd like to know if you have any data you used when testing this code.
Or could I know information such as the format of the input data?
For reference, I applied IOP using the get_tile_data function of your utils library.

I hope you will be able to guide me through.

Best regards
Ji-Won

@lifeodyssey
Copy link

Hi,

I have used him code. So maybe I can help you this question.
For example, in the QAA.py you can saw the input of QAA function.
You can add the band of GOCI-II and use it as a input.

By the way, did the GOCI-II data open to public now?

@BrandonSmithJ
Copy link
Owner

@jiwoni-ind I'm assuming this is referring to the MDN repository, and not this one on band-adjustment. In which case, both QAA and GIOP can be used by passing in the Rrs (as a numpy array shaped [number of samples, number of bands]), and the wavelengths (as a numpy array shaped [number of bands]).

GIOP additionally needs the sensor name passed in, e.g. OLI for Landsat-8. The problem in your case is, GIOP needs an estimate of chlorophyll to work, which is calculated via OC3. There is no GOCI-II definition for OC3, and so you will not be able to use GIOP for that sensor unless the OC3 definition is included.

To use get_tile_data with these functions, you'll need to reshape the input correctly first - get_tile_data returns Rrs in the shape of [height, width, number of bands], whereas you need [number of samples, number of bands]. Once Rrs is reshaped, you should be able to pass it into the QAA function (along with the bands) without issue.

Let me know if this answers your question.

@jiwoni-ind
Copy link
Author

jiwoni-ind commented Oct 12, 2021

Hi,

I have used him code. So maybe I can help you this question. For example, in the QAA.py you can saw the input of QAA function. You can add the band of GOCI-II and use it as a input.

By the way, did the GOCI-II data open to public now?

@lifeodyssey

Thank you for your willingness to help.

Currently, GOCI-II data are provided by the Korea National Oceanic and Atmospheric Research Institute.
Here is the link: (I don't know if access is possible.)
http://www.khoa.go.kr/nosc/satellite/searchL2.do

If access is not possible, please help with GOCI data.
GOCI data is provided by Ocean Color Data web. (see link below)
https://oceandata.sci.gsfc.nasa.gov/directaccess/GOCI/

First, added information from meta.py GOCI-II.

  • SENSOR_LABEL = 'GC2' : 'GOCI-2'
  • SENSOR_BANDS = 'GC2' : [380, 412, 443, 490, 510, 555, 620, 660, 680, 709, 745, 865]

When using QAA.py, the code is executed as follows.

import utils2, QAA
import numpy as np

fname = "D:/data/GK2_GC2/LA_L2/AC/20210809/GK2B_GOCI2_L2_20210809_031530_LA_S007_AC.nc"
#fname = "D:/data/COMS/L2/G2021054001644.L2_COMS_OC.nc"
data = utils2.get_tile_data(filenames=fname, sensor='GOCI-2', allow_neg=True, rhos=False, anc=False)
wavelengths = data[0]
Rrs = data[1]
qaa = QAA.model(Rrs, wavelengths)

Also, when using GIOP.py, the code is executed as follows.

import utils2, GIOP
import numpy as np

fname = "D:/data/GK2_GC2/LA_L2/AC/20210809/GK2B_GOCI2_L2_20210809_031530_LA_S007_AC.nc"
data = utils2.get_tile_data(filenames=fname, sensor='GOCI-2', allow_neg=True, rhos=False, anc=False)
wavelengths = data[0]
Rrs = data[1]
sensor = 'GOCI-2'

giop = GIOP.model(Rrs, wavelengths, sensor)

@jiwoni-ind
Copy link
Author

jiwoni-ind commented Oct 12, 2021

@jiwoni-ind I'm assuming this is referring to the MDN repository, and not this one on band-adjustment. In which case, both QAA and GIOP can be used by passing in the Rrs (as a numpy array shaped [number of samples, number of bands]), and the wavelengths (as a numpy array shaped [number of bands]).

GIOP additionally needs the sensor name passed in, e.g. OLI for Landsat-8. The problem in your case is, GIOP needs an estimate of chlorophyll to work, which is calculated via OC3. There is no GOCI-II definition for OC3, and so you will not be able to use GIOP for that sensor unless the OC3 definition is included.

To use get_tile_data with these functions, you'll need to reshape the input correctly first - get_tile_data returns Rrs in the shape of [height, width, number of bands], whereas you need [number of samples, number of bands]. Once Rrs is reshaped, you should be able to pass it into the QAA function (along with the bands) without issue.

Let me know if this answers your question.

@BrandonSmithJ

Thank you. I noticed the problem with my source code in your reply.

The shape of the data read using get_tile_data is [2780, 2780, 12] as [number of row, number of col, number of bands].
I think the problem was that I used it as an input value for QAA and GIOP.

When get_tile_data is used, the type of the return value is a (2,) tuple.
The first index of the tuple contains bands.
In the case of GOCI-II, [380, 412, 443, 490, 510, 555, 620, 660, 680, 709, 745, 865] is returned.
The second index contains the value of Rrs for each band, and is a three-dimensional numpy array. (As mentioned above, it is in the form of (2780,2780,12).)
I used these two return values as input values (wavelengths, Rrs) for QAA and GIOP.

But I have one question. The QAA function requires Rrs, wavelengths.
As you said, Rrs needs to be reshape such as [number of samples, number of bands]. What does sample count mean here?

@BrandonSmithJ
Copy link
Owner

Sample count is just the number of (in this case) pixels you want estimates for. So ignoring any masking applied to the pixels, you would have height * width = 2780 * 2780 = 7,728,400 samples. Reshaping the Rrs array via e.g. Rrs.reshape((-1, Rrs.shape[-1])) and feeding that into QAA should get you the results you expect. The results can then be reshaped back into the image shape if that's the format you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants