var_all1, lon_all1, lat_all1, sza_all1 = \
        ceres.read_day_of_ssf_files(
            path='/Users/rcscott2/Desktop/CRS/ASDC_archive/SSF_Ed4A/',
            file_struc='CER_SSF_Terra-FM1-MODIS_Edition4A_404405.2019010' +
                        str(day+1),
            variable='CERES LW TOA flux - upwards',
            index=-1, fill=True)

    # computes var_all2 minus var_all1
    diff, fov_wgt = ceres.swath_difference(field2=var_all2,
                                           field1=var_all1,
                                           day=True,
                                           sza=sza_all2,
                                           lat=lat_all2)

    diff_colormap = ceres.set_colormap(cmap_name=Balance_20, typ_arg=0)

    cf_colormap = ceres.set_colormap(cmap_name=Davos_3_r, typ_arg=0)
    # ceres.plot_swath(
    #     lon=lon_all2, lat=lat_all2, field=fov_wgt,
    #     nrows=1, ncols=1, cen_lon=0,
    #     varname='FOV cos(latitude)',
    #     levname='', varunits='',
    #     cmap=diff_colormap, cmap_lims=(0, 1),
    #     date='2019010' + str(day + 1), date_str='01/0' + str(day + 1) + '/2019:00-23h',
    #     nightshade=False,
    #     title_str='',
    #     marker='o', msize=1)

    # ceres.plot_swath(
    #     lon=lon_all2, lat=lat_all2, field=cf_lo,
print('============================================')
print('\t\t\tComputing difference...\t\t\t')
print('============================================')

difference, _ = ceres.swath_difference(field2=field2,
                                       field1=field1,
                                       day=-1,
                                       sza=sza,
                                       lat=lat)

print('============================================')
print('\t\t\tSetting colormap...\t\t\t')
print('============================================')

colormap = ceres.set_colormap(cmap_name=Balance_20, typ_arg=0)
colormap1 = ceres.set_colormap(cmap_name=LaPaz_20, typ_arg=0)

print('============================================')
print('\t\t\tPlotting data...\t\t\t')
print('============================================')

title_str = 'CERES ' + ceres.get_platform(file1) + ' CRS Ed2G'
cen_lon = 180

ceres.plot_swath(lon=lon,
                 lat=lat,
                 field=field1,
                 nrows=1,
                 ncols=1,
                 cen_lon=cen_lon,
print(spec_sw_tot.shape)

spec_lw_tot, spec_lw_tot_name, spec_lw_tot_units, spec_lw_tot_lev, =\
    ceres.read_crs_var_dev(file_path=file_path,
                           var_name='Spectral LW surface flux - downward - total sky',
                           lev_arg=-1, fill=True)

print(spec_lw_tot.shape)

print('============================================')
print('\tPlotting Data...\t\t\t')
print('============================================')

# Cloud fraction colormap
cf_colormap = ceres.set_colormap(cmap_name=Devon_20, typ_arg=0)

# SW colormap - nice options = LaJolla_20_r, Nuuk_20
sw_colormap = ceres.set_colormap(cmap_name=LaPaz_20, typ_arg=0)
# LW colormap - nice options = Deep_20_r, Thermal_20, Bilbao_20
lw_colormap = ceres.set_colormap(cmap_name=LaJolla_20, typ_arg=0)
# Flux difference colormap
fd_colormap = ceres.set_colormap(cmap_name=Balance_20, typ_arg=0)

# title = platform + ' - Cloud Radiative Swath (CRS) Development'
title = 'Terra FM1 - Cloud Radiative Swath (CRS) Development'

# Clouds

# ceres.plot_swath(lon=lon, lat=lat, field=cld_frac_tot, nrows=1, ncols=1, cen_lon=0,
#                  varname=cld_frac_name, levname='', varunits=cld_frac_units,
예제 #4
0
path = '/Users/rcscott2/Desktop/CERES/EBAF/'
file = 'CERES_EBAF-TOA_Ed4.1_Subset_200003-201910.nc'
file_path = path + file

# ========================================================================

# -------------------------------------------------------
# print information about the nc file
# -------------------------------------------------------
ceres.print_nc_file_info(file_path)

# -------------------------------------------------------
# set the colormap
# -------------------------------------------------------
cmap = ceres.set_colormap(Balance_20, 0)

# -------------------------------------------------------
# read latitude and longitude information from file
# -------------------------------------------------------

latitude, longitude, lat, lon, time = ceres.read_ebaf_geolocation(
    file_path=file_path)

start_mo, start_yr = ceres.read_ebaf_start_month_year(file_path=file_path)

# -------------------------------------------------------
# read variables including their name and units
# -------------------------------------------------------

lwf, lwf_name, lwf_units = ceres.read_ebaf_var(file_path=file_path,
예제 #5
0
                                 fill=True)

# CERES Ed4 CRS data
# var_all4, lon_all4, lat_all4, sza_all4 = ceres.read_day_of_crs_files(
#                                path='/Users/rcscott2/Desktop/CRS/my_output/JAN-2019_/',
#                                file_struc='CER_CRS4_Terra-FM1-MODIS_GH4_1111TH.20190101',
#                                variable='Shortwave flux - upward - total sky',
#                                lev_arg=0,
#                                fill=True)


# Grid and average footprints into 1 deg x 1 deg grid boxes
gridded_var_all4 = ceres.grid_to_1x1_deg_equal_angle(lat_all4, lon_all4, var_all4)


# select colormap
cmap = ceres.set_colormap(Thermal_20, 0)

# plot the gridded field
ceres.global_map(lon=lon, lat=lat, field=gridded_var_all4,
                 varname='CERES LW TOA flux - upwards', varunits=r'W m$^{-2}$',
                 nrows=1, ncols=1, cen_lon=0,
                 cmap=cmap, cmap_lims=(150, 350), ti_str='CERES Terra FM1 "CRS1deg" JAN-01-2019')

plt.imshow(gridded_var_all4)
plt.colorbar()
plt.clim(vmin=150, vmax=350)
plt.show()


# convert list(str) of lat/lon to np arrays
val_site_lats = np.asarray(val_site_lats, dtype=np.float)
val_site_lons = np.asarray(val_site_lons, dtype=np.float)
val_site_type = np.asarray(val_site_type, dtype=np.int)

# create a list of tuples containing site lat, lon, & name
sites = list(zip(val_site_name, val_site_lats, val_site_lons, val_site_type))
# convert to list of lists
sites = [list(el) for el in sites]

# construct an output file for each site, add to "sites" list of lists
for i, site in enumerate(sites):
    file = site[0] + '_' + prod + '_' + satellite + '_' + date + '.txt'
    sites[i].append(file)

cmap = ceres.set_colormap(Bold_6, typ_arg=1)
ceres.validation_sites(lon=val_site_lons,
                       lat=val_site_lats,
                       type_ids=val_site_type,
                       title_str='CERES CAVE Surface Validation Sites',
                       date_str='',
                       cmap=cmap)

# sys.exit()

# read in full month of CRS data
fov_lon, fov_lat, fov_tim, fov_sza, fov_swd, fov_lwd, fov_cf1, fov_cf2 = \
    ceres.read_crs_files_validation(
        path='/Users/rcscott2/Desktop/CRS/my_output/JAN-2019_/',
        file_struc='CER_CRS4_Terra-FM1-MODIS_GH4_1111TH.201901')
예제 #7
0
        var_all1[i] = np.nan
        var_all2[i] = np.nan

# ignore/remove NaNs
bad_indices = np.isnan(diff)
good_indices = ~bad_indices
lat_all1 = lat_all1[good_indices]
lon_all1 = lon_all1[good_indices]
lat_all2 = lat_all2[good_indices]
lon_all2 = lon_all2[good_indices]
var_all1 = var_all1[good_indices]
var_all2 = var_all2[good_indices]
sza_all1 = sza_all1[good_indices]
diff = diff[good_indices]

diff_colormap = ceres.set_colormap(cmap_name=Acton_20, typ_arg=1)

ceres.plot_swath(
    lon=lon_all2,
    lat=lat_all2,
    field=var_all2,
    nrows=1,
    ncols=1,
    cen_lon=0,
    varname='Snow/Ice percent coverage clear-sky overhead-sun vis albedo',
    levname='',
    varunits='%',
    cmap=diff_colormap,
    cmap_lims=(0, 100),
    date='20190101',
    date_str='01/01/2019:00-22h',
예제 #8
0
    gridded_field, grid_lon, grid_lat = \
        ceres.grid_to_equal_angle_grid(
            grid_res_lat=0.5,
            grid_res_lon=0.5,
            variable=terra_var_all,
            lon_data=terra_lon_all,
            lat_data=terra_lat_all,
            lon_360=True)

    # Plot fluxes below a certain threshold
    # gridded_field[gridded_field > 180] = np.nan

    date_str = mo + '/' + day + '/2020:' + hr + 'h'

    # set colormap
    cmap = ceres.set_colormap(Deep_20_r, 0)
    # cmap = 'viridis'
    #
    ceres.plot_gridded_fields(
        nrows=1,
        ncols=1,
        cen_lon=0,
        date_str='',
        title_str=['FLASHFlux v3C Aqua FM3 - ' + date_str],
        cmap=cmap,
        cmap_lims=((0, 700), (0, 700)),
        varname='Reflected Shortwave Radiation',
        levname='TOA',
        varunits=r'W m$^{-2}$',
        lon=grid_lon,
        lat=grid_lat,
diff = diff[good_indices]

print('Length of SZA, VZA, diff:')
print(len(sza_all3))
print(len(vza_all3))
print(len(diff))

print('Length of lon, lat:')
print(len(lon_all3))
print(len(lat_all3))

print('============================================')
print('\t\t\tPlotting swaths...\t\t\t')
print('============================================')

diff_colormap = ceres.set_colormap(cmap_name=Balance_20, typ_arg=0)

ceres.plot_swath(lon=lon_all3,
                 lat=lat_all3,
                 field=sza_all3,
                 nrows=1,
                 ncols=1,
                 cen_lon=0,
                 varname='CERES solar zenith angle',
                 levname='surface',
                 varunits='degrees',
                 cmap=diff_colormap,
                 cmap_lims=(0, 90),
                 date='20190101',
                 date_str='01/01/2019:00-22h',
                 nightshade=False,