pyresample.ewa._ll2cr module

Map longitude/latitude points to column/rows of a grid.

pyresample.ewa._ll2cr.ll2cr_dynamic(lon_arr, lat_arr, fill_in, src_crs, dst_crs, cell_width, cell_height, width=None, height=None, origin_x=None, origin_y=None)

Project longitude and latitude points to column rows in the specified grid in place.

This function is meant to operate on dynamic grids and is theoretically slower than the ll2cr_static function. Dynamic grids are those that have one or more set of parameters unspecified like the number of pixels in the grid (width, height) or the origin coordinates of the grid (origin_x, origin_y). This function will analyze the provided lon/lat data and determine what the missing parameters must be so all input swath data falls in the resulting grid.

Parameters:
  • lon_arr – Numpy array of longitude floats

  • lat_arr – Numpy array of latitude floats

  • grid_info – dictionary of grid information (see below)

  • fill_in – Fill value for input longitude and latitude arrays and used for output

  • proj4_definition – PROJ.4 string projection definition

  • cell_width – Pixel resolution in the X direction in projection space

  • cell_height – Pixel resolution in the Y direction in projection space

  • width – (optional) Number of pixels in the X direction in the final output grid

  • height – (optional) Number of pixels in the Y direction in the final output grid

  • origin_x – (optional) Grid X coordinate for the upper-left pixel of the output grid

  • origin_y – (optional) Grid Y coordinate for the upper-left pixel of the output grid

Returns:

tuple(points_in_grid, cols_out, rows_out, origin_x, origin_y, width, height)

Steps taken in this function:

  1. Convert (lon, lat) points to (X, Y) points in the projection space

  2. If grid is missing some parameters (dynamic grid), then fill them in

  3. Convert (X, Y) points to (column, row) points in the grid space

Note longitude and latitude arrays are limited to 64-bit floats because of limitations in pyproj.

pyresample.ewa._ll2cr.ll2cr_static(lon_arr, lat_arr, fill_in, src_crs, dst_crs, cell_width, cell_height, width, height, origin_x, origin_y)

Project longitude and latitude points to column rows in the specified grid in place.

Parameters:
  • lon_arr – Numpy array of longitude floats

  • lat_arr – Numpy array of latitude floats

  • fill_in – Fill value for input longitude and latitude arrays and used for output

  • cell_width – Pixel resolution in the X direction in projection space

  • cell_height – Pixel resolution in the Y direction in projection space

  • width – Number of pixels in the X direction in the final output grid

  • height – Number of pixels in the Y direction in the final output grid

  • origin_x – Grid X coordinate for the upper-left pixel of the output grid

  • origin_y – Grid Y coordinate for the upper-left pixel of the output grid

Returns:

tuple(points_in_grid, cols_out, rows_out)

Steps taken in this function:

  1. Convert (lon, lat) points to (X, Y) points in the projection space

  2. Convert (X, Y) points to (column, row) points in the grid space

Note longitude and latitude arrays are limited to 64-bit floats because of limitations in pyproj.

pyresample.ewa._ll2cr.projection_circumference(t)

Return the projection circumference if the projection is cylindrical, None otherwise.

Projections that are not cylindrical and centered on the globes axis can not easily have data cross the antimeridian of the projection.