Skip to content

Instantly share code, notes, and snippets.

@NimishMishra
Created April 22, 2019 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NimishMishra/2bf6e559cfc2e2ba7bdcaf94705f9c53 to your computer and use it in GitHub Desktop.
Save NimishMishra/2bf6e559cfc2e2ba7bdcaf94705f9c53 to your computer and use it in GitHub Desktop.
# Creates a list of values of the product under observation across all datasets
def create_list(PRODUCT, CITY_LATITUDE, CITY_LONGITUDE, FILEPATH):
latitude_dataframe, lat_row, lat_column = find_latitude_position(CITY_LATITUDE, FILEPATH)
if lat_row == -1:
return -1
longitude_dataframe, lon_column = find_longitude_position(CITY_LONGITUDE, lat_row, FILEPATH)
city_row_number = lat_row
city_column_number = lon_column
if(PRODUCT == 'AOD'):
subdataset = 'Deep_Blue_Aerosol_Optical_Depth_550_Land mod04 (16-bit integer)'
elif(PRODUCT == 'Scattering Angle'):
subdataset = 'Scattering_Angle mod04 (16-bit integer)'
elif(PRODUCT == 'Cloud Fraction'):
subdataset = 'Deep_Blue_Cloud_Fraction_Land (16-bit integer)'
elif(PRODUCT == 'Combined'):
subdataset = 'AOD_550_Dark_Target_Deep_Blue_Combined (16-bit integer)'
elif(PRODUCT == 'Angstrom Exponent'):
subdataset = 'Deep_Blue_Angstrom_Exponent_Land (16-bit integer)'
row_begin = city_row_number - 1
row_end = city_row_number + 1
column_begin = city_column_number - 1
column_end = city_column_number + 1
total = 0
for i in range(row_begin, row_end, 1):
for j in range(column_begin, column_end, 1):
pixel_value = find_product_value(i, j, subdataset, FILEPATH)
if(pixel_value == -9999):
pixel_value = 0
total = total + pixel_value
product_value = total / 9
return product_value, latitude_dataframe.iloc[lat_row][lat_column], longitude_dataframe.iloc[lat_row][lon_column]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment