ornldaac / gedi_tutorials

GEDI L3 and L4 Tutorials
Other
113 stars 50 forks source link

Parameters and their values in `model_data` #5

Closed Prakash-Basnet closed 2 years ago

Prakash-Basnet commented 2 years ago

Hello, When I run this line, I got 'NaN' value for all Predict_stratum, model_name, x_transform, y_transform, bia_correction, fit_stratum as follows. How can I fix this issue?

image
rupesh2 commented 2 years ago

Hi @Prakash-Basnet, Thank you for contacting us. Can you share which HDF file was showing the NaN values? The example file GEDI04_A_2020207182449_O09168_03_T03028_02_002_02_V002.h5 shown in the tutorial does not have any NaN values.

Prakash-Basnet commented 2 years ago

Hi,

I am trying on this file GEDI04_A_2019175071755_O03004_03_T04466_02_002_02_V002.h5 following all scripts that are provided. But, at that step, I got NAN values. Also, I tried with the data used in the tutorial but again I encountered the same NaN value. Is there any step that I missed otherwise it should work?

Here is the link to what I did,

Test_GEDI_L4aExploring GEDI L4A - Jupyter Notebook http://localhost:8888/notebooks/Test_GEDI_L4aExploring%20GEDI%20L4A.ipynb

Regards,

On Wed, Mar 30, 2022 at 1:36 PM Rupesh Shrestha @.***> wrote:

Hi @Prakash-Basnet https://github.com/Prakash-Basnet, Thank you for contacting us. Can you share which HDF file was showing the NaN values? The example file GEDI04_A_2020207182449_O09168_03_T03028_02_002_02_V002.h5 shown in the tutorial does not have any NaN values.

— Reply to this email directly, view it on GitHub https://github.com/ornldaac/gedi_tutorials/issues/5#issuecomment-1083022346, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS2NYFIWZ7GQUYJCCSQURPDVCQ4E7ANCNFSM5SBSTFSQ . You are receiving this because you were mentioned.Message ID: @.***>

rupesh2 commented 2 years ago

Hi @Prakash-Basnet , I ran the following code (from Tutorial 3) for your h5 file:

# GEDI L4a file
l4a = 'GEDI04_A_2019175071755_O03004_03_T04466_02_002_02_V002.h5'
l4af = path.join('full_orbits', l4a)
# read the L4A file
hf = h5py.File(l4af, 'r')
# initialize an empty dataframe
model_data_df = pd.DataFrame()
ancillary = hf['ANCILLARY']
model_data = ancillary['model_data']

# loop through parameters
for v in model_data.dtype.names:
    # exclude multidimensional variables
    if (len(model_data[v].shape) == 1):
        # copy parameters as dataframe column
        model_data_df[v] = model_data[v]
        # converting object datatype to string
        if model_data_df[v].dtype.kind=='O':
            model_data_df[v] = model_data_df[v].str.decode('utf-8') 
hf.close()
# print the parameters
print(f'Table. Parameters and their values in `model_data` subgroup')
model_data_df

It prints the following for me, with no NaN values:

Screen Shot 2022-03-30 at 12 08 32 PM

Can you try running the above code in your Jupyter notebook and see if you still see NaN values?

Prakash-Basnet commented 2 years ago

Hello,

I don't know what is going on in my machine. Here, I pasted all the above codes with the same input file. But still, the same value came, maybe there is something else making this error. Can you notice anything errors in the code below in my notebook? Also, I import all packages as you mentioned in the tutorial.

Anyway, thank you.

[image: image.png]

Regards,

On Wed, Mar 30, 2022 at 6:14 PM Rupesh Shrestha @.***> wrote:

Hi @Prakash-Basnet https://github.com/Prakash-Basnet , I ran the following code (from Tutorial 3) for your h5 file:

GEDI L4a filel4a = 'GEDI04_A_2019175071755_O03004_03_T04466_02_002_02_V002.h5'l4af = path.join('full_orbits', l4a)# read the L4A filehf = h5py.File(l4af, 'r')# initialize an empty dataframemodel_data_df = pd.DataFrame()ancillary = hf['ANCILLARY']model_data = ancillary['model_data']

loop through parametersfor v in model_data.dtype.names:

# exclude multidimensional variables
if (len(model_data[v].shape) == 1):
    # copy parameters as dataframe column
    model_data_df[v] = model_data[v]
    # converting object datatype to string
    if model_data_df[v].dtype.kind=='O':
        model_data_df[v] = model_data_df[v].str.decode('utf-8') hf.close()# print the parametersprint(f'Table. Parameters and their values in `model_data` subgroup')model_data_df

It prints the following for me, with no NaN values: [image: Screen Shot 2022-03-30 at 12 08 32 PM] https://user-images.githubusercontent.com/9683694/160881030-8d409422-0b4e-403e-a25c-4b5731704d5a.png

Can you try running the above code in your Jupyter notebook and see if you still see NaN values?

— Reply to this email directly, view it on GitHub https://github.com/ornldaac/gedi_tutorials/issues/5#issuecomment-1083343804, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS2NYFJOSII5WCJ2ALR7NA3VCR4VLANCNFSM5SBSTFSQ . You are receiving this because you were mentioned.Message ID: @.***>

rupesh2 commented 2 years ago

@Prakash-Basnet I do not see "[image: image.png]". You probably need to attach it via github.

Prakash-Basnet commented 2 years ago

Sorry, Here it is,

image
rupesh2 commented 2 years ago

@Prakash-Basnet I see that you have a Windows machine. I guess it might be a Windows-specific issue with decoding. Can you try removing the part .str.decode('utf-8') from the code and run it?

Prakash-Basnet commented 2 years ago

Thank you very much. Finally, It comes with value. After removing that part it works.