@@ -949,7 +949,9 @@ def make_grid_SG(csres, stretch_factor, target_lon, target_lat):
949949
950950
951951def calc_rectilinear_lon_edge (lon_stride , center_at_180 ):
952- """ Compute longitude edge vector for a rectilinear grid.
952+ """
953+ Compute longitude edge vector for a rectilinear grid.
954+
953955 Parameters
954956 ----------
955957 lon_stride: float
@@ -959,26 +961,20 @@ def calc_rectilinear_lon_edge(lon_stride, center_at_180):
959961 Whether or not the grid should have a cell center at 180 degrees (i.e.
960962 on the date line). If true, the first grid cell is centered on the date
961963 line; if false, the first grid edge is on the date line.
964+
962965 Returns
963966 -------
964967 Longitudes of cell edges in degrees East.
968+
965969 Notes
966970 -----
967971 All values are forced to be between [-180,180]. For a grid with N cells in
968972 each band, N+1 edges will be returned, with the first and last value being
969973 duplicates.
970- Examples
971- --------
972- >>> from gcpy.grid.horiz import calc_rectilinear_lon_edge
973- >>> calc_rectilinear_lon_edge(5.0,true)
974- np.array([177.5,-177.5,-172.5,...,177.5])
975- See Also
976- --------
977- [NONE]
978974 """
979975
980- n_lon = np .round (360.0 / lon_stride )
981- lon_edge = np .linspace (- 180.0 , 180.0 , num = n_lon + 1 )
976+ n_lon_edge = int ( np .round (360.0 / lon_stride )) + 1
977+ lon_edge = np .linspace (- 180.0 , 180.0 , num = n_lon_edge )
982978 if center_at_180 :
983979 lon_edge = lon_edge - (lon_stride / 2.0 )
984980
@@ -989,7 +985,9 @@ def calc_rectilinear_lon_edge(lon_stride, center_at_180):
989985
990986
991987def calc_rectilinear_lat_edge (lat_stride , half_polar_grid ):
992- """ Compute latitude edge vector for a rectilinear grid.
988+ """
989+ Compute latitude edge vector for a rectilinear grid.
990+
993991 Parameters
994992 ----------
995993 lat_stride: float
@@ -1000,31 +998,26 @@ def calc_rectilinear_lat_edge(lat_stride, half_polar_grid):
1000998 half the size). In either case the grid will start and end at -/+ 90,
1001999 but when half_polar_grid is True, the first and last bands will have a
10021000 width of 1/2 the normal lat_stride.
1001+
10031002 Returns
10041003 -------
10051004 Latitudes of cell edges in degrees North.
1005+
10061006 Notes
10071007 -----
10081008 All values are forced to be between [-90,90]. For a grid with N cells in
10091009 each band, N+1 edges will be returned, with the first and last value being
10101010 duplicates.
1011- Examples
1012- --------
1013- >>> from gcpy.grid.horiz import calc_rectilinear_lat_edge
1014- >>> calc_rectilinear_lat_edge(4.0,true)
1015- np.array([-90,-88,-84,-80,...,84,88,90])
1016- See Also
1017- --------
1018- [NONE]
10191011 """
10201012
10211013 if half_polar_grid :
10221014 start_pt = 90.0 + (lat_stride / 2.0 )
10231015 else :
10241016 start_pt = 90.0
10251017
1026- lat_edge = np .linspace (- 1.0 * start_pt , start_pt ,
1027- num = 1 + np .round (2.0 * start_pt / lat_stride ))
1018+ n_lat_edge = int (np .round (2.0 * start_pt / lat_stride )) + 1
1019+
1020+ lat_edge = np .linspace (- 1.0 * start_pt , start_pt , num = n_lat_edge )
10281021
10291022 # Force back onto +/- 90
10301023 lat_edge [lat_edge > 90.0 ] = 90.0
@@ -1034,22 +1027,17 @@ def calc_rectilinear_lat_edge(lat_stride, half_polar_grid):
10341027
10351028
10361029def calc_rectilinear_grid_area (lon_edge , lat_edge ):
1037- """ Compute grid cell areas (in m2) for a rectilinear grid.
1030+ """
1031+ Compute grid cell areas (in m2) for a rectilinear grid.
1032+
10381033 Parameters
10391034 ----------
1040- #TODO
1035+ lon_edge : float : Grid box longitude edges (in degrees north)
1036+ lat_edge : float : Grid box latitude edges (in degrees east)
1037+
10411038 Returns
10421039 -------
1043- #TODO
1044- Notes
1045- -----
1046- #TODO
1047- Examples
1048- --------
1049- #TODO
1050- See Also
1051- --------
1052- [NONE]
1040+ area : float : Array of grid box areas in m2.
10531041 """
10541042
10551043 # Convert from km to m
0 commit comments