# Path: pyresample/test/utils.py
# def create_test_latitude(start, stop, shape, twist_factor=0.0, dtype=np.float32):
#     """Get basic sample of latitude data."""
#     num_cols = 1 if len(shape) < 2 else shape[1]
#     lat_col = np.linspace(start, stop, num=shape[0]).astype(dtype).reshape((shape[0], 1))
#     twist_array = np.arange(num_cols) * twist_factor
#     lat_array = np.repeat(lat_col, num_cols, axis=1)
#     lat_array += twist_array
#     return lat_array
# 
# def create_test_longitude(start, stop, shape, twist_factor=0.0, dtype=np.float32):
#     """Get basic sample of longitude data."""
#     if start > 0 > stop:
#         # cross anti-meridian
#         stop += 360.0
# 
#     num_cols = 1 if len(shape) < 2 else shape[1]
#     lon_row = np.linspace(start, stop, num=num_cols).astype(dtype)
#     twist_array = np.arange(shape[0]).reshape((shape[0], 1)) * twist_factor
#     lon_array = np.repeat([lon_row], shape[0], axis=0)
#     lon_array += twist_array
# 
#     if stop > 360.0:
#         lon_array[lon_array > 360.0] -= 360
#     return lon_array


import io
import os
import pathlib
import unittest
import uuid
import numpy as np
    import rasterio
        import pyresample.utils as utils
        import tempfile
    import xarray as xr
    import xarray as xr
    import xarray as xr
    import xarray as xr
from tempfile import NamedTemporaryFile
from pyproj import CRS
from pyresample.test.utils import create_test_latitude, create_test_longitude
        from pyresample import parse_area_file
        from pyresample import load_area
        from pyresample.area_config import load_area
        from pyresample.area_config import AreaNotFound, parse_area_file
        from pyresample import parse_area_file
        from pyresample import parse_area_file
        from pyresample import parse_area_file
        from pyresample.geometry import DynamicAreaDefinition
        from pyresample import parse_area_file
        from pyresample.geometry import DynamicAreaDefinition
        from pyresample import parse_area_file
        from pyresample import parse_area_file
        from pyresample.area_config import load_area_from_string
        from pyresample import geometry, utils
        from pyresample import geometry, utils
        from pyresample import geometry, utils
        from pyresample import geometry, utils
        from pyresample import utils
        from pyresample import utils
        from pyresample import get_area_def
        from pyresample import utils
        from pyresample import utils
        from pyresample import utils
        from pyresample import utils
        from collections import OrderedDict
        from pyresample import utils
        from pyresample import convert_def_to_yaml, parse_area_file
        from affine import Affine
        from rasterio.crs import CRS as RCRS
        from pyresample import utils
        from rasterio.crs import CRS as RCRS
        from pyresample import utils
        from affine import Affine
        from pyresample import utils
        from affine import Affine
        from pyresample import utils
        from affine import Affine
        from pyresample import utils
        from pyresample.area_config import load_area
        from pyresample.area_config import load_area
        from pyresample.area_config import load_area
        from pyresample.area_config import load_area
    from pyresample.geometry import AreaDefinition
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils.cf import _guess_cf_lonlat_varname
        from pyresample.utils.cf import _guess_cf_axis_varname
        from pyresample.utils.cf import (
            _is_valid_coordinate_standardname,
            _valid_cf_type_of_grid_mapping,
        )
        from pyresample.utils.cf import _is_valid_coordinate_variable
        from pyresample.utils.cf import _load_crs_from_cf_gridmapping
    from pyresample.utils import check_slice_orientation
        os.remove(f.name)


# helper routines for the CF test cases
def _prepare_cf_nh10km():
    nx = 760
    ny = 1120
    ds = xr.Dataset({'ice_conc': (('time', 'yc', 'xc'), np.ma.masked_all((1, ny, nx)),
                                  {'grid_mapping': 'Polar_Stereographic_Grid'}),
                     'xc': ('xc', np.linspace(-3845, 3745, num=nx),
                            {'standard_name': 'projection_x_coordinate', 'units': 'km'}),
                     'yc': ('yc', np.linspace(+5845, -5345, num=ny),
                            {'standard_name': 'projection_y_coordinate', 'units': 'km'})},
                    coords={'lat': (('yc', 'xc'), np.ma.masked_all((ny, nx))),
                            'lon': (('yc', 'xc'), np.ma.masked_all((ny, nx)))},)
    ds['lat'].attrs['units'] = 'degrees_north'
    ds['lat'].attrs['standard_name'] = 'latitude'
    ds['lon'].attrs['units'] = 'degrees_east'
    ds['lon'].attrs['standard_name'] = 'longitude'

    ds['Polar_Stereographic_Grid'] = 0
    ds['Polar_Stereographic_Grid'].attrs['grid_mapping_name'] = "polar_stereographic"
    ds['Polar_Stereographic_Grid'].attrs['false_easting'] = 0.
    ds['Polar_Stereographic_Grid'].attrs['false_northing'] = 0.
    ds['Polar_Stereographic_Grid'].attrs['semi_major_axis'] = 6378273.
    ds['Polar_Stereographic_Grid'].attrs['semi_minor_axis'] = 6356889.44891
    ds['Polar_Stereographic_Grid'].attrs['straight_vertical_longitude_from_pole'] = -45.
    ds['Polar_Stereographic_Grid'].attrs['latitude_of_projection_origin'] = 90.
    ds['Polar_Stereographic_Grid'].attrs['standard_parallel'] = 70.


# Path: pyresample/test/utils.py
# def create_test_latitude(start, stop, shape, twist_factor=0.0, dtype=np.float32):
#     """Get basic sample of latitude data."""
#     num_cols = 1 if len(shape) < 2 else shape[1]
#     lat_col = np.linspace(start, stop, num=shape[0]).astype(dtype).reshape((shape[0], 1))
#     twist_array = np.arange(num_cols) * twist_factor
#     lat_array = np.repeat(lat_col, num_cols, axis=1)
#     lat_array += twist_array
#     return lat_array
# 
# def create_test_longitude(start, stop, shape, twist_factor=0.0, dtype=np.float32):
#     """Get basic sample of longitude data."""
#     if start > 0 > stop:
#         # cross anti-meridian
#         stop += 360.0
# 
#     num_cols = 1 if len(shape) < 2 else shape[1]
#     lon_row = np.linspace(start, stop, num=num_cols).astype(dtype)
#     twist_array = np.arange(shape[0]).reshape((shape[0], 1)) * twist_factor
#     lon_array = np.repeat([lon_row], shape[0], axis=0)
#     lon_array += twist_array
# 
#     if stop > 360.0:
#         lon_array[lon_array > 360.0] -= 360
#     return lon_array


# Path: pyresample/test/test_utils.py
import io
import os
import pathlib
import unittest
import uuid
import numpy as np
    import rasterio
        import pyresample.utils as utils
        import tempfile
    import xarray as xr
    import xarray as xr
    import xarray as xr
    import xarray as xr
from tempfile import NamedTemporaryFile
from pyproj import CRS
from pyresample.test.utils import create_test_latitude, create_test_longitude
        from pyresample import parse_area_file
        from pyresample import load_area
        from pyresample.area_config import load_area
        from pyresample.area_config import AreaNotFound, parse_area_file
        from pyresample import parse_area_file
        from pyresample import parse_area_file
        from pyresample import parse_area_file
        from pyresample.geometry import DynamicAreaDefinition
        from pyresample import parse_area_file
        from pyresample.geometry import DynamicAreaDefinition
        from pyresample import parse_area_file
        from pyresample import parse_area_file
        from pyresample.area_config import load_area_from_string
        from pyresample import geometry, utils
        from pyresample import geometry, utils
        from pyresample import geometry, utils
        from pyresample import geometry, utils
        from pyresample import utils
        from pyresample import utils
        from pyresample import get_area_def
        from pyresample import utils
        from pyresample import utils
        from pyresample import utils
        from pyresample import utils
        from collections import OrderedDict
        from pyresample import utils
        from pyresample import convert_def_to_yaml, parse_area_file
        from affine import Affine
        from rasterio.crs import CRS as RCRS
        from pyresample import utils
        from rasterio.crs import CRS as RCRS
        from pyresample import utils
        from affine import Affine
        from pyresample import utils
        from affine import Affine
        from pyresample import utils
        from affine import Affine
        from pyresample import utils
        from pyresample.area_config import load_area
        from pyresample.area_config import load_area
        from pyresample.area_config import load_area
        from pyresample.area_config import load_area
    from pyresample.geometry import AreaDefinition
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils import load_cf_area
        from pyresample.utils.cf import _guess_cf_lonlat_varname
        from pyresample.utils.cf import _guess_cf_axis_varname
        from pyresample.utils.cf import (
            _is_valid_coordinate_standardname,
            _valid_cf_type_of_grid_mapping,
        )
        from pyresample.utils.cf import _is_valid_coordinate_variable
        from pyresample.utils.cf import _load_crs_from_cf_gridmapping
    from pyresample.utils import check_slice_orientation

        os.remove(f.name)


# helper routines for the CF test cases
def _prepare_cf_nh10km():
    nx = 760
    ny = 1120
    ds = xr.Dataset({'ice_conc': (('time', 'yc', 'xc'), np.ma.masked_all((1, ny, nx)),
                                  {'grid_mapping': 'Polar_Stereographic_Grid'}),
                     'xc': ('xc', np.linspace(-3845, 3745, num=nx),
                            {'standard_name': 'projection_x_coordinate', 'units': 'km'}),
                     'yc': ('yc', np.linspace(+5845, -5345, num=ny),
                            {'standard_name': 'projection_y_coordinate', 'units': 'km'})},
                    coords={'lat': (('yc', 'xc'), np.ma.masked_all((ny, nx))),
                            'lon': (('yc', 'xc'), np.ma.masked_all((ny, nx)))},)
    ds['lat'].attrs['units'] = 'degrees_north'
    ds['lat'].attrs['standard_name'] = 'latitude'
    ds['lon'].attrs['units'] = 'degrees_east'
    ds['lon'].attrs['standard_name'] = 'longitude'

    ds['Polar_Stereographic_Grid'] = 0
    ds['Polar_Stereographic_Grid'].attrs['grid_mapping_name'] = "polar_stereographic"
    ds['Polar_Stereographic_Grid'].attrs['false_easting'] = 0.
    ds['Polar_Stereographic_Grid'].attrs['false_northing'] = 0.
    ds['Polar_Stereographic_Grid'].attrs['semi_major_axis'] = 6378273.
    ds['Polar_Stereographic_Grid'].attrs['semi_minor_axis'] = 6356889.44891
    ds['Polar_Stereographic_Grid'].attrs['straight_vertical_longitude_from_pole'] = -45.
    ds['Polar_Stereographic_Grid'].attrs['latitude_of_projection_origin'] = 90.
    ds['Polar_Stereographic_Grid'].attrs['standard_parallel'] = 70.


    return ds