nmathewa / tropcyc

Tropical cyclone exp
0 stars 0 forks source link

Empty and NAN datasets exists in the output images (nc files) #11

Open nmathewa opened 11 months ago

nmathewa commented 11 months ago
nmathewa commented 11 months ago
for ii in range(len(stat_dft)):
    nc_file = stat_dft['files'].iloc[ii]
    dset = xr.open_dataset(nc_file)

    all_vars = list(dset.keys())

    all_arrs = []
    for jj in all_vars:
        dset_data = dset[jj].values
        all_arrs += [dset_data]

    try:
        n_data = np.dstack(all_arrs)

    except ValueError:
        print("file empty")
        continue
    if np.isnan(n_data).any():
        continue
    else:

        cyc_ids += [stat_dft['cyclone_id'].iloc[ii]]
        lead_times += [stat_dft['lead_time'].iloc[ii]]

        imgs += [np.dstack(all_arrs)]