Permalink
Browse files

fixing the index calculation for grids that aren't 1 degree

  • Loading branch information...
1 parent 71e008c commit 994e14da43c7f7264388a71206f87bf1ee4cde2e Eva Schiffer committed Feb 14, 2014
Showing with 4 additions and 4 deletions.
  1. +4 −4 stg/space_gridding.py
View
@@ -33,10 +33,10 @@ def calculate_index_from_nav_data (aux_data, grid_degrees) :
night_lat_temp = aux_data[LAT_KEY][aux_data[NIGHT_MASK_KEY]]
# figure out where the day/night indexes will fall
- day_lon_index = numpy.round((aux_data[LON_KEY][aux_data[DAY_MASK_KEY]] + 180.0) / grid_degrees) % 360
- day_lat_index = numpy.round((aux_data[LAT_KEY][aux_data[DAY_MASK_KEY]] + 90.0) / grid_degrees) % 180
- night_lon_index = numpy.round((aux_data[LON_KEY][aux_data[NIGHT_MASK_KEY]] + 180.0) / grid_degrees) % 360
- night_lat_index = numpy.round((aux_data[LAT_KEY][aux_data[NIGHT_MASK_KEY]] + 90.0) / grid_degrees) % 180
+ day_lon_index = numpy.round((aux_data[LON_KEY][aux_data[DAY_MASK_KEY]] + 180.0) / grid_degrees) % (360.0 / grid_degrees)
+ day_lat_index = numpy.round((aux_data[LAT_KEY][aux_data[DAY_MASK_KEY]] + 90.0) / grid_degrees) % (180.0 / grid_degrees)
+ night_lon_index = numpy.round((aux_data[LON_KEY][aux_data[NIGHT_MASK_KEY]] + 180.0) / grid_degrees) % (360.0 / grid_degrees)
+ night_lat_index = numpy.round((aux_data[LAT_KEY][aux_data[NIGHT_MASK_KEY]] + 90.0) / grid_degrees) % (180.0 / grid_degrees)
return day_lon_index, day_lat_index, night_lon_index, night_lat_index

0 comments on commit 994e14d

Please sign in to comment.