idx int64 0 252k | question stringlengths 48 5.28k | target stringlengths 5 1.23k |
|---|---|---|
247,400 | def reduce ( self , op ) : per_band = [ getattr ( np . ma , op ) ( self . image . data [ band , np . ma . getmaskarray ( self . image ) [ band , : , : ] == np . False_ ] ) for band in range ( self . num_bands ) ] return per_band | Reduce the raster to a score using op operation . |
247,401 | def mask ( self , vector , mask_shape_nodata = False ) : from telluric . collections import BaseCollection cropped = self . crop ( vector ) if isinstance ( vector , BaseCollection ) : shapes = [ cropped . to_raster ( feature ) for feature in vector ] else : shapes = [ cropped . to_raster ( vector ) ] mask = geometry_ma... | Set pixels outside vector as nodata . |
247,402 | def mask_by_value ( self , nodata ) : return self . copy_with ( image = np . ma . masked_array ( self . image . data , mask = self . image . data == nodata ) ) | Return raster with a mask calculated based on provided value . Only pixels with value = nodata will be masked . |
247,403 | def save_cloud_optimized ( self , dest_url , resampling = Resampling . gauss , blocksize = 256 , overview_blocksize = 256 , creation_options = None ) : src = self with tempfile . NamedTemporaryFile ( suffix = '.tif' ) as tf : src . save ( tf . name , overviews = False ) convert_to_cog ( tf . name , dest_url , resamplin... | Save as Cloud Optimized GeoTiff object to a new file . |
247,404 | def _get_window_out_shape ( self , bands , window , xsize , ysize ) : if xsize and ysize is None : ratio = window . width / xsize ysize = math . ceil ( window . height / ratio ) elif ysize and xsize is None : ratio = window . height / ysize xsize = math . ceil ( window . width / ratio ) elif xsize is None and ysize is ... | Get the outshape of a window . |
247,405 | def _read_with_mask ( raster , masked ) : if masked is None : mask_flags = raster . mask_flag_enums per_dataset_mask = all ( [ rasterio . enums . MaskFlags . per_dataset in flags for flags in mask_flags ] ) masked = per_dataset_mask return masked | returns if we should read from rasterio using the masked |
247,406 | def get_window ( self , window , bands = None , xsize = None , ysize = None , resampling = Resampling . cubic , masked = None , affine = None ) : bands = bands or list ( range ( 1 , self . num_bands + 1 ) ) out_shape = self . _get_window_out_shape ( bands , window , xsize , ysize ) try : read_params = { "window" : wind... | Get window from raster . |
247,407 | def _get_tile_when_web_mercator_crs ( self , x_tile , y_tile , zoom , bands = None , masked = None , resampling = Resampling . cubic ) : roi = GeoVector . from_xyz ( x_tile , y_tile , zoom ) coordinates = roi . get_bounds ( WEB_MERCATOR_CRS ) window = self . _window ( coordinates , to_round = False ) bands = bands or l... | The reason we want to treat this case in a special way is that there are cases where the rater is aligned so you need to be precise on which raster you want |
247,408 | def get_tile ( self , x_tile , y_tile , zoom , bands = None , masked = None , resampling = Resampling . cubic ) : if self . crs == WEB_MERCATOR_CRS : return self . _get_tile_when_web_mercator_crs ( x_tile , y_tile , zoom , bands , masked , resampling ) roi = GeoVector . from_xyz ( x_tile , y_tile , zoom ) left , bottom... | Convert mercator tile to raster window . |
247,409 | def colorize ( self , colormap , band_name = None , vmin = None , vmax = None ) : vmin = vmin if vmin is not None else min ( self . min ( ) ) vmax = vmax if vmax is not None else max ( self . max ( ) ) cmap = matplotlib . cm . get_cmap ( colormap ) band_index = 0 if band_name is None : if self . num_bands > 1 : warning... | Apply a colormap on a selected band . |
247,410 | def chunks ( self , shape = 256 , pad = False ) : _self = self . _raster_backed_by_a_file ( ) if isinstance ( shape , int ) : shape = ( shape , shape ) ( width , height ) = shape col_steps = int ( _self . width / width ) row_steps = int ( _self . height / height ) col_extra_step = 1 if _self . width % width > 0 else 0 ... | This method returns GeoRaster chunks out of the original raster . |
247,411 | def dissolve ( collection , aggfunc = None ) : new_properties = { } if aggfunc : temp_properties = defaultdict ( list ) for feature in collection : for key , value in feature . attributes . items ( ) : temp_properties [ key ] . append ( value ) for key , values in temp_properties . items ( ) : try : new_properties [ ke... | Dissolves features contained in a FeatureCollection and applies an aggregation function to its properties . |
247,412 | def filter ( self , intersects ) : try : crs = self . crs vector = intersects . geometry if isinstance ( intersects , GeoFeature ) else intersects prepared_shape = prep ( vector . get_shape ( crs ) ) hits = [ ] for feature in self : target_shape = feature . geometry . get_shape ( crs ) if prepared_shape . overlaps ( ta... | Filter results that intersect a given GeoFeature or Vector . |
247,413 | def sort ( self , by , desc = False ) : if callable ( by ) : key = by else : def key ( feature ) : return feature [ by ] sorted_features = sorted ( list ( self ) , reverse = desc , key = key ) return self . __class__ ( sorted_features ) | Sorts by given property or function ascending or descending order . |
247,414 | def groupby ( self , by ) : results = OrderedDict ( ) for feature in self : if callable ( by ) : value = by ( feature ) else : value = feature [ by ] results . setdefault ( value , [ ] ) . append ( feature ) if hasattr ( self , "_schema" ) : schema = getattr ( self , "_schema" ) return _CollectionGroupBy ( results , sc... | Groups collection using a value of a property . |
247,415 | def dissolve ( self , by = None , aggfunc = None ) : if by : agg = partial ( dissolve , aggfunc = aggfunc ) return self . groupby ( by ) . agg ( agg ) else : return FeatureCollection ( [ dissolve ( self , aggfunc ) ] ) | Dissolve geometries and rasters within groupby . |
247,416 | def rasterize ( self , dest_resolution , * , polygonize_width = 0 , crs = WEB_MERCATOR_CRS , fill_value = None , bounds = None , dtype = None , ** polygonize_kwargs ) : from telluric . georaster import merge_all , MergeStrategy from telluric . rasterization import rasterize , NODATA_DEPRECATION_WARNING if not isinstanc... | Binarize a FeatureCollection and produce a raster with the target resolution . |
247,417 | def save ( self , filename , driver = None , schema = None ) : if driver is None : driver = DRIVERS . get ( os . path . splitext ( filename ) [ - 1 ] ) if schema is None : schema = self . schema if driver == "GeoJSON" : with contextlib . suppress ( FileNotFoundError ) : os . remove ( filename ) crs = WGS84_CRS else : c... | Saves collection to file . |
247,418 | def apply ( self , ** kwargs ) : def _apply ( f ) : properties = copy . deepcopy ( f . properties ) for prop , value in kwargs . items ( ) : if callable ( value ) : properties [ prop ] = value ( f ) else : properties [ prop ] = value return f . copy_with ( properties = properties ) new_fc = self . map ( _apply ) new_sc... | Return a new FeatureCollection with the results of applying the statements in the arguments to each element . |
247,419 | def validate ( self ) : if self . _schema is not None : with MemoryFile ( ) as memfile : with memfile . open ( driver = "ESRI Shapefile" , schema = self . schema ) as target : for _item in self . _results : item = GeoFeature ( _item . geometry , _item . properties ) target . write ( item . to_record ( item . crs ) ) | if schema exists we run shape file validation code of fiona by trying to save to in MemoryFile |
247,420 | def open ( cls , filename , crs = None ) : with fiona . Env ( ) : with fiona . open ( filename , 'r' ) as source : original_crs = CRS ( source . crs ) schema = source . schema length = len ( source ) crs = crs or original_crs ret_val = cls ( filename , crs , schema , length ) return ret_val | Creates a FileCollection from a file in disk . |
247,421 | def filter ( self , func ) : results = OrderedDict ( ) for name , group in self : if func ( group ) : results [ name ] = group return self . __class__ ( results ) | Filter out Groups based on filtering function . |
247,422 | def reset_context ( ** options ) : local_context . _options = { } local_context . _options . update ( options ) log . debug ( "New TelluricContext context %r created" , local_context . _options ) | Reset context to default . |
247,423 | def get_context ( ) : if not local_context . _options : raise TelluricContextError ( "TelluricContext context not exists" ) else : log . debug ( "Got a copy of context %r options" , local_context . _options ) return local_context . _options . copy ( ) | Get a mapping of current options . |
247,424 | def set_context ( ** options ) : if not local_context . _options : raise TelluricContextError ( "TelluricContext context not exists" ) else : local_context . _options . update ( options ) log . debug ( "Updated existing %r with options %r" , local_context . _options , options ) | Set options in the existing context . |
247,425 | def transform_properties ( properties , schema ) : new_properties = properties . copy ( ) for prop_value , ( prop_name , prop_type ) in zip ( new_properties . values ( ) , schema [ "properties" ] . items ( ) ) : if prop_value is None : continue elif prop_type == "time" : new_properties [ prop_name ] = parse_date ( prop... | Transform properties types according to a schema . |
247,426 | def serialize_properties ( properties ) : new_properties = properties . copy ( ) for attr_name , attr_value in new_properties . items ( ) : if isinstance ( attr_value , datetime ) : new_properties [ attr_name ] = attr_value . isoformat ( ) elif not isinstance ( attr_value , ( dict , list , tuple , str , int , float , b... | Serialize properties . |
247,427 | def from_record ( cls , record , crs , schema = None ) : properties = cls . _to_properties ( record , schema ) vector = GeoVector ( shape ( record [ 'geometry' ] ) , crs ) if record . get ( 'raster' ) : assets = { k : dict ( type = RASTER_TYPE , product = 'visual' , ** v ) for k , v in record . get ( 'raster' ) . items... | Create GeoFeature from a record . |
247,428 | def copy_with ( self , geometry = None , properties = None , assets = None ) : def copy_assets_object ( asset ) : obj = asset . get ( "__object" ) if hasattr ( "copy" , obj ) : new_obj = obj . copy ( ) if obj : asset [ "__object" ] = new_obj geometry = geometry or self . geometry . copy ( ) new_properties = copy . deep... | Generate a new GeoFeature with different geometry or preperties . |
247,429 | def from_raster ( cls , raster , properties , product = 'visual' ) : footprint = raster . footprint ( ) assets = raster . to_assets ( product = product ) return cls ( footprint , properties , assets ) | Initialize a GeoFeature object with a GeoRaster |
247,430 | def has_raster ( self ) : return any ( asset . get ( 'type' ) == RASTER_TYPE for asset in self . assets . values ( ) ) | True if any of the assets is type raster . |
247,431 | def transform ( shape , source_crs , destination_crs = None , src_affine = None , dst_affine = None ) : if destination_crs is None : destination_crs = WGS84_CRS if src_affine is not None : shape = ops . transform ( lambda r , q : ~ src_affine * ( r , q ) , shape ) shape = generate_transform ( source_crs , destination_c... | Transforms shape from one CRS to another . |
247,432 | def simple_plot ( feature , * , mp = None , ** map_kwargs ) : from telluric . collections import BaseCollection if mp is None : mp = folium . Map ( tiles = "Stamen Terrain" , ** map_kwargs ) if feature . is_empty : warnings . warn ( "The geometry is empty." ) else : if isinstance ( feature , BaseCollection ) : feature ... | Plots a GeoVector in a simple Folium map . |
247,433 | def zoom_level_from_geometry ( geometry , splits = 4 ) : from telluric . vectors import generate_tile_coordinates levels = [ ] for chunk in generate_tile_coordinates ( geometry , ( splits , splits ) ) : levels . append ( mercantile . bounding_tile ( * chunk . get_shape ( WGS84_CRS ) . bounds ) . z ) return median_low (... | Generate optimum zoom level for geometry . |
247,434 | def layer_from_element ( element , style_function = None ) : from telluric . collections import BaseCollection if isinstance ( element , BaseCollection ) : styled_element = element . map ( lambda feat : style_element ( feat , style_function ) ) else : styled_element = style_element ( element , style_function ) return G... | Return Leaflet layer from shape . |
247,435 | def plot ( feature , mp = None , style_function = None , ** map_kwargs ) : map_kwargs . setdefault ( 'basemap' , basemaps . Stamen . Terrain ) if feature . is_empty : warnings . warn ( "The geometry is empty." ) mp = Map ( ** map_kwargs ) if mp is None else mp else : if mp is None : center = feature . envelope . centro... | Plots a GeoVector in an ipyleaflet map . |
247,436 | def tileserver_optimized_raster ( src , dest ) : src_raster = tl . GeoRaster2 . open ( src ) bounding_box = src_raster . footprint ( ) . get_shape ( tl . constants . WGS84_CRS ) . bounds tile = mercantile . bounding_tile ( * bounding_box ) dest_resolution = mercator_upper_zoom_level ( src_raster ) bounds = tl . GeoVect... | This method converts a raster to a tileserver optimized raster . The method will reproject the raster to align to the xyz system in resolution and projection It will also create overviews And finally it will arragne the raster in a cog way . You could take the dest file upload it to a web server that supports ranges an... |
247,437 | def get_dimension ( geometry ) : coordinates = geometry [ "coordinates" ] type_ = geometry [ "type" ] if type_ in ( 'Point' , ) : return len ( coordinates ) elif type_ in ( 'LineString' , 'MultiPoint' ) : return len ( coordinates [ 0 ] ) elif type_ in ( 'Polygon' , 'MultiLineString' ) : return len ( coordinates [ 0 ] [... | Gets the dimension of a Fiona - like geometry element . |
247,438 | def from_geojson ( cls , filename ) : with open ( filename ) as fd : geometry = json . load ( fd ) if 'type' not in geometry : raise TypeError ( "%s is not a valid geojson." % ( filename , ) ) return cls ( to_shape ( geometry ) , WGS84_CRS ) | Load vector from geojson . |
247,439 | def to_geojson ( self , filename ) : with open ( filename , 'w' ) as fd : json . dump ( self . to_record ( WGS84_CRS ) , fd ) | Save vector as geojson . |
247,440 | def from_bounds ( cls , xmin , ymin , xmax , ymax , crs = DEFAULT_CRS ) : return cls ( Polygon . from_bounds ( xmin , ymin , xmax , ymax ) , crs ) | Creates GeoVector object from bounds . |
247,441 | def from_xyz ( cls , x , y , z ) : bb = xy_bounds ( x , y , z ) return cls . from_bounds ( xmin = bb . left , ymin = bb . bottom , xmax = bb . right , ymax = bb . top , crs = WEB_MERCATOR_CRS ) | Creates GeoVector from Mercator slippy map values . |
247,442 | def cascaded_union ( cls , vectors , dst_crs , prevalidate = False ) : try : shapes = [ geometry . get_shape ( dst_crs ) for geometry in vectors ] if prevalidate : if not all ( [ sh . is_valid for sh in shapes ] ) : warnings . warn ( "Some invalid shapes found, discarding them." ) except IndexError : crs = DEFAULT_CRS ... | Generate a GeoVector from the cascade union of the impute vectors . |
247,443 | def from_record ( cls , record , crs ) : if 'type' not in record : raise TypeError ( "The data isn't a valid record." ) return cls ( to_shape ( record ) , crs ) | Load vector from record . |
247,444 | def get_bounding_box ( self , crs ) : return self . from_bounds ( * self . get_bounds ( crs ) , crs = crs ) | Gets bounding box as GeoVector in a specified CRS . |
247,445 | def polygonize ( self , width , cap_style_line = CAP_STYLE . flat , cap_style_point = CAP_STYLE . round ) : shape = self . _shape if isinstance ( shape , ( LineString , MultiLineString ) ) : return self . __class__ ( shape . buffer ( width / 2 , cap_style = cap_style_line ) , self . crs ) elif isinstance ( shape , ( Po... | Turns line or point into a buffered polygon . |
247,446 | def tiles ( self , zooms , truncate = False ) : west , south , east , north = self . get_bounds ( WGS84_CRS ) return tiles ( west , south , east , north , zooms , truncate ) | Iterator over the tiles intersecting the bounding box of the vector |
247,447 | def _join_masks_from_masked_array ( data ) : if not isinstance ( data . mask , np . ndarray ) : mask = np . empty ( data . data . shape , dtype = np . bool ) mask . fill ( data . mask ) return mask mask = data . mask [ 0 ] . copy ( ) for i in range ( 1 , len ( data . mask ) ) : mask = np . logical_or ( mask , data . ma... | Union of masks . |
247,448 | def _creation_options_for_cog ( creation_options , source_profile , blocksize ) : if not ( creation_options ) : creation_options = { } creation_options [ "blocksize" ] = blocksize creation_options [ "tiled" ] = True defaults = { "nodata" : None , "compress" : "lzw" } for key in [ "nodata" , "compress" ] : if key not in... | it uses the profile of the source raster override anything using the creation_options and guarantees we will have tiled raster and blocksize |
247,449 | def convert_to_cog ( source_file , destination_file , resampling = rasterio . enums . Resampling . gauss , blocksize = 256 , overview_blocksize = 256 , creation_options = None ) : with rasterio . open ( source_file ) as src : source_profile = src . profile creation_options = _creation_options_for_cog ( creation_options... | Convert source file to a Cloud Optimized GeoTiff new file . |
247,450 | def warp ( source_file , destination_file , dst_crs = None , resolution = None , dimensions = None , src_bounds = None , dst_bounds = None , src_nodata = None , dst_nodata = None , target_aligned_pixels = False , check_invert_proj = True , creation_options = None , resampling = Resampling . cubic , ** kwargs ) : with r... | Warp a raster dataset . |
247,451 | def build_overviews ( source_file , factors = None , minsize = 256 , external = False , blocksize = 256 , interleave = 'pixel' , compress = 'lzw' , resampling = Resampling . gauss , ** kwargs ) : with rasterio . open ( source_file , 'r+' ) as dst : if factors is None : factors = _calc_overviews_factors ( SimpleNamespac... | Build overviews at one or more decimation factors for all bands of the dataset . |
247,452 | def build_vrt ( source_file , destination_file , ** kwargs ) : with rasterio . open ( source_file ) as src : vrt_doc = boundless_vrt_doc ( src , ** kwargs ) . tostring ( ) with open ( destination_file , 'wb' ) as dst : dst . write ( vrt_doc ) return destination_file | Make a VRT XML document and write it in file . |
247,453 | def stretch_histogram ( img , dark_clip_percentile = None , bright_clip_percentile = None , dark_clip_value = None , bright_clip_value = None , ignore_zero = True ) : if ( dark_clip_percentile is not None and dark_clip_value is not None ) or ( bright_clip_percentile is not None and bright_clip_value is not None ) : rai... | Stretch img histogram . |
247,454 | def _distribution_info ( self ) : print ( 'Gathering information...' ) system = platform . system ( ) system = 'cygwin' if 'CYGWIN' in system else system processor = platform . processor ( ) machine = '64bit' if sys . maxsize > 2 ** 32 else '32bit' print ( 'SYSTEM: ' , system ) print ( 'PROCESSOR:' , processor ) prin... | Creates the distribution name and the expected extension for the CSPICE package and returns it . |
247,455 | def _download ( self ) : if ssl . OPENSSL_VERSION < 'OpenSSL 1.0.1g' : import urllib3 . contrib . pyopenssl urllib3 . contrib . pyopenssl . inject_into_urllib3 ( ) import certifi import urllib3 try : proxies = { } for key , value in os . environ . items ( ) : if '_proxy' in key . lower ( ) : proxies [ key . lower ( ) .... | Support function that encapsulates the OpenSSL transfer of the CSPICE package to the self . _local io . ByteIO stream . |
247,456 | def _unpack ( self ) : if self . _ext == 'zip' : with ZipFile ( self . _local , 'r' ) as archive : archive . extractall ( self . _root ) else : cmd = 'gunzip | tar xC ' + self . _root proc = subprocess . Popen ( cmd , shell = True , stdin = subprocess . PIPE ) proc . stdin . write ( self . _local . read ( ) ) self . _l... | Unpacks the CSPICE package on the given root directory . Note that Package could either be the zipfile . ZipFile class for Windows platforms or tarfile . TarFile for other platforms . |
247,457 | def spiceErrorCheck ( f ) : @ functools . wraps ( f ) def with_errcheck ( * args , ** kwargs ) : try : res = f ( * args , ** kwargs ) checkForSpiceError ( f ) return res except : raise return with_errcheck | Decorator for spiceypy hooking into spice error system . If an error is detected an output similar to outmsg |
247,458 | def spiceFoundExceptionThrower ( f ) : @ functools . wraps ( f ) def wrapper ( * args , ** kwargs ) : res = f ( * args , ** kwargs ) if config . catch_false_founds : found = res [ - 1 ] if isinstance ( found , bool ) and not found : raise stypes . SpiceyError ( "Spice returns not found for function: {}" . format ( f . ... | Decorator for wrapping functions that use status codes |
247,459 | def appndc ( item , cell ) : assert isinstance ( cell , stypes . SpiceCell ) if isinstance ( item , list ) : for c in item : libspice . appndc_c ( stypes . stringToCharP ( c ) , cell ) else : item = stypes . stringToCharP ( item ) libspice . appndc_c ( item , cell ) | Append an item to a character cell . |
247,460 | def appndd ( item , cell ) : assert isinstance ( cell , stypes . SpiceCell ) if hasattr ( item , "__iter__" ) : for d in item : libspice . appndd_c ( ctypes . c_double ( d ) , cell ) else : item = ctypes . c_double ( item ) libspice . appndd_c ( item , cell ) | Append an item to a double precision cell . |
247,461 | def appndi ( item , cell ) : assert isinstance ( cell , stypes . SpiceCell ) if hasattr ( item , "__iter__" ) : for i in item : libspice . appndi_c ( ctypes . c_int ( i ) , cell ) else : item = ctypes . c_int ( item ) libspice . appndi_c ( item , cell ) | Append an item to an integer cell . |
247,462 | def axisar ( axis , angle ) : axis = stypes . toDoubleVector ( axis ) angle = ctypes . c_double ( angle ) r = stypes . emptyDoubleMatrix ( ) libspice . axisar_c ( axis , angle , r ) return stypes . cMatrixToNumpy ( r ) | Construct a rotation matrix that rotates vectors by a specified angle about a specified axis . |
247,463 | def badkpv ( caller , name , comp , insize , divby , intype ) : caller = stypes . stringToCharP ( caller ) name = stypes . stringToCharP ( name ) comp = stypes . stringToCharP ( comp ) insize = ctypes . c_int ( insize ) divby = ctypes . c_int ( divby ) intype = ctypes . c_char ( intype . encode ( encoding = 'UTF-8' ) )... | Determine if a kernel pool variable is present and if so that it has the correct size and type . |
247,464 | def bltfrm ( frmcls , outCell = None ) : frmcls = ctypes . c_int ( frmcls ) if not outCell : outCell = stypes . SPICEINT_CELL ( 1000 ) libspice . bltfrm_c ( frmcls , outCell ) return outCell | Return a SPICE set containing the frame IDs of all built - in frames of a specified class . |
247,465 | def bodc2n ( code , lenout = _default_len_out ) : code = ctypes . c_int ( code ) name = stypes . stringToCharP ( " " * lenout ) lenout = ctypes . c_int ( lenout ) found = ctypes . c_int ( ) libspice . bodc2n_c ( code , lenout , name , ctypes . byref ( found ) ) return stypes . toPythonString ( name ) , bool ( found . v... | Translate the SPICE integer code of a body into a common name for that body . |
247,466 | def bodc2s ( code , lenout = _default_len_out ) : code = ctypes . c_int ( code ) name = stypes . stringToCharP ( " " * lenout ) lenout = ctypes . c_int ( lenout ) libspice . bodc2s_c ( code , lenout , name ) return stypes . toPythonString ( name ) | Translate a body ID code to either the corresponding name or if no name to ID code mapping exists the string representation of the body ID value . |
247,467 | def bodfnd ( body , item ) : body = ctypes . c_int ( body ) item = stypes . stringToCharP ( item ) return bool ( libspice . bodfnd_c ( body , item ) ) | Determine whether values exist for some item for any body in the kernel pool . |
247,468 | def bodn2c ( name ) : name = stypes . stringToCharP ( name ) code = ctypes . c_int ( 0 ) found = ctypes . c_int ( 0 ) libspice . bodn2c_c ( name , ctypes . byref ( code ) , ctypes . byref ( found ) ) return code . value , bool ( found . value ) | Translate the name of a body or object to the corresponding SPICE integer ID code . |
247,469 | def bods2c ( name ) : name = stypes . stringToCharP ( name ) code = ctypes . c_int ( 0 ) found = ctypes . c_int ( 0 ) libspice . bods2c_c ( name , ctypes . byref ( code ) , ctypes . byref ( found ) ) return code . value , bool ( found . value ) | Translate a string containing a body name or ID code to an integer code . |
247,470 | def bodvcd ( bodyid , item , maxn ) : bodyid = ctypes . c_int ( bodyid ) item = stypes . stringToCharP ( item ) dim = ctypes . c_int ( ) values = stypes . emptyDoubleVector ( maxn ) maxn = ctypes . c_int ( maxn ) libspice . bodvcd_c ( bodyid , item , maxn , ctypes . byref ( dim ) , values ) return dim . value , stypes ... | Fetch from the kernel pool the double precision values of an item associated with a body where the body is specified by an integer ID code . |
247,471 | def bodvrd ( bodynm , item , maxn ) : bodynm = stypes . stringToCharP ( bodynm ) item = stypes . stringToCharP ( item ) dim = ctypes . c_int ( ) values = stypes . emptyDoubleVector ( maxn ) maxn = ctypes . c_int ( maxn ) libspice . bodvrd_c ( bodynm , item , maxn , ctypes . byref ( dim ) , values ) return dim . value ,... | Fetch from the kernel pool the double precision values of an item associated with a body . |
247,472 | def bschoc ( value , ndim , lenvals , array , order ) : value = stypes . stringToCharP ( value ) ndim = ctypes . c_int ( ndim ) lenvals = ctypes . c_int ( lenvals ) array = stypes . listToCharArrayPtr ( array , xLen = lenvals , yLen = ndim ) order = stypes . toIntVector ( order ) return libspice . bschoc_c ( value , nd... | Do a binary search for a given value within a character string array accompanied by an order vector . Return the index of the matching array entry or - 1 if the key value is not found . |
247,473 | def bschoi ( value , ndim , array , order ) : value = ctypes . c_int ( value ) ndim = ctypes . c_int ( ndim ) array = stypes . toIntVector ( array ) order = stypes . toIntVector ( order ) return libspice . bschoi_c ( value , ndim , array , order ) | Do a binary search for a given value within an integer array accompanied by an order vector . Return the index of the matching array entry or - 1 if the key value is not found . |
247,474 | def bsrchc ( value , ndim , lenvals , array ) : value = stypes . stringToCharP ( value ) ndim = ctypes . c_int ( ndim ) lenvals = ctypes . c_int ( lenvals ) array = stypes . listToCharArrayPtr ( array , xLen = lenvals , yLen = ndim ) return libspice . bsrchc_c ( value , ndim , lenvals , array ) | Do a binary earch for a given value within a character string array . Return the index of the first matching array entry or - 1 if the key value was not found . |
247,475 | def bsrchd ( value , ndim , array ) : value = ctypes . c_double ( value ) ndim = ctypes . c_int ( ndim ) array = stypes . toDoubleVector ( array ) return libspice . bsrchd_c ( value , ndim , array ) | Do a binary search for a key value within a double precision array assumed to be in increasing order . Return the index of the matching array entry or - 1 if the key value is not found . |
247,476 | def bsrchi ( value , ndim , array ) : value = ctypes . c_int ( value ) ndim = ctypes . c_int ( ndim ) array = stypes . toIntVector ( array ) return libspice . bsrchi_c ( value , ndim , array ) | Do a binary search for a key value within an integer array assumed to be in increasing order . Return the index of the matching array entry or - 1 if the key value is not found . |
247,477 | def ccifrm ( frclss , clssid , lenout = _default_len_out ) : frclss = ctypes . c_int ( frclss ) clssid = ctypes . c_int ( clssid ) lenout = ctypes . c_int ( lenout ) frcode = ctypes . c_int ( ) frname = stypes . stringToCharP ( lenout ) center = ctypes . c_int ( ) found = ctypes . c_int ( ) libspice . ccifrm_c ( frclss... | Return the frame name frame ID and center associated with a given frame class and class ID . |
247,478 | def cgv2el ( center , vec1 , vec2 ) : center = stypes . toDoubleVector ( center ) vec1 = stypes . toDoubleVector ( vec1 ) vec2 = stypes . toDoubleVector ( vec2 ) ellipse = stypes . Ellipse ( ) libspice . cgv2el_c ( center , vec1 , vec2 , ctypes . byref ( ellipse ) ) return ellipse | Form a SPICE ellipse from a center vector and two generating vectors . |
247,479 | def cidfrm ( cent , lenout = _default_len_out ) : cent = ctypes . c_int ( cent ) lenout = ctypes . c_int ( lenout ) frcode = ctypes . c_int ( ) frname = stypes . stringToCharP ( lenout ) found = ctypes . c_int ( ) libspice . cidfrm_c ( cent , lenout , ctypes . byref ( frcode ) , frname , ctypes . byref ( found ) ) retu... | Retrieve frame ID code and name to associate with a frame center . |
247,480 | def ckcov ( ck , idcode , needav , level , tol , timsys , cover = None ) : ck = stypes . stringToCharP ( ck ) idcode = ctypes . c_int ( idcode ) needav = ctypes . c_int ( needav ) level = stypes . stringToCharP ( level ) tol = ctypes . c_double ( tol ) timsys = stypes . stringToCharP ( timsys ) if not cover : cover = s... | Find the coverage window for a specified object in a specified CK file . |
247,481 | def cklpf ( filename ) : filename = stypes . stringToCharP ( filename ) handle = ctypes . c_int ( ) libspice . cklpf_c ( filename , ctypes . byref ( handle ) ) return handle . value | Load a CK pointing file for use by the CK readers . Return that file s handle to be used by other CK routines to refer to the file . |
247,482 | def ckobj ( ck , outCell = None ) : assert isinstance ( ck , str ) ck = stypes . stringToCharP ( ck ) if not outCell : outCell = stypes . SPICEINT_CELL ( 1000 ) assert isinstance ( outCell , stypes . SpiceCell ) assert outCell . dtype == 2 libspice . ckobj_c ( ck , ctypes . byref ( outCell ) ) return outCell | Find the set of ID codes of all objects in a specified CK file . |
247,483 | def ckopn ( filename , ifname , ncomch ) : filename = stypes . stringToCharP ( filename ) ifname = stypes . stringToCharP ( ifname ) ncomch = ctypes . c_int ( ncomch ) handle = ctypes . c_int ( ) libspice . ckopn_c ( filename , ifname , ncomch , ctypes . byref ( handle ) ) return handle . value | Open a new CK file returning the handle of the opened file . |
247,484 | def ckw01 ( handle , begtim , endtim , inst , ref , avflag , segid , nrec , sclkdp , quats , avvs ) : handle = ctypes . c_int ( handle ) begtim = ctypes . c_double ( begtim ) endtim = ctypes . c_double ( endtim ) inst = ctypes . c_int ( inst ) ref = stypes . stringToCharP ( ref ) avflag = ctypes . c_int ( avflag ) segi... | Add a type 1 segment to a C - kernel . |
247,485 | def ckw02 ( handle , begtim , endtim , inst , ref , segid , nrec , start , stop , quats , avvs , rates ) : handle = ctypes . c_int ( handle ) begtim = ctypes . c_double ( begtim ) endtim = ctypes . c_double ( endtim ) inst = ctypes . c_int ( inst ) ref = stypes . stringToCharP ( ref ) segid = stypes . stringToCharP ( s... | Write a type 2 segment to a C - kernel . |
247,486 | def ckw03 ( handle , begtim , endtim , inst , ref , avflag , segid , nrec , sclkdp , quats , avvs , nints , starts ) : handle = ctypes . c_int ( handle ) begtim = ctypes . c_double ( begtim ) endtim = ctypes . c_double ( endtim ) inst = ctypes . c_int ( inst ) ref = stypes . stringToCharP ( ref ) avflag = ctypes . c_in... | Add a type 3 segment to a C - kernel . |
247,487 | def ckw05 ( handle , subtype , degree , begtim , endtim , inst , ref , avflag , segid , sclkdp , packts , rate , nints , starts ) : handle = ctypes . c_int ( handle ) subtype = ctypes . c_int ( subtype ) degree = ctypes . c_int ( degree ) begtim = ctypes . c_double ( begtim ) endtim = ctypes . c_double ( endtim ) inst ... | Write a type 5 segment to a CK file . |
247,488 | def cltext ( fname ) : fnameP = stypes . stringToCharP ( fname ) fname_len = ctypes . c_int ( len ( fname ) ) libspice . cltext_ ( fnameP , fname_len ) | Internal undocumented command for closing a text file opened by RDTEXT . |
247,489 | def cmprss ( delim , n , instr , lenout = _default_len_out ) : delim = ctypes . c_char ( delim . encode ( encoding = 'UTF-8' ) ) n = ctypes . c_int ( n ) instr = stypes . stringToCharP ( instr ) output = stypes . stringToCharP ( lenout ) libspice . cmprss_c ( delim , n , instr , lenout , output ) return stypes . toPyth... | Compress a character string by removing occurrences of more than N consecutive occurrences of a specified character . |
247,490 | def cnmfrm ( cname , lenout = _default_len_out ) : lenout = ctypes . c_int ( lenout ) frname = stypes . stringToCharP ( lenout ) cname = stypes . stringToCharP ( cname ) found = ctypes . c_int ( ) frcode = ctypes . c_int ( ) libspice . cnmfrm_c ( cname , lenout , ctypes . byref ( frcode ) , frname , ctypes . byref ( fo... | Retrieve frame ID code and name to associate with an object . |
247,491 | def convrt ( x , inunit , outunit ) : inunit = stypes . stringToCharP ( inunit ) outunit = stypes . stringToCharP ( outunit ) y = ctypes . c_double ( ) if hasattr ( x , "__iter__" ) : outArray = [ ] for n in x : libspice . convrt_c ( n , inunit , outunit , ctypes . byref ( y ) ) outArray . append ( y . value ) return o... | Take a measurement X the units associated with X and units to which X should be converted ; return Y the value of the measurement in the output units . |
247,492 | def copy ( cell ) : assert isinstance ( cell , stypes . SpiceCell ) if cell . dtype is 0 : newcopy = stypes . SPICECHAR_CELL ( cell . size , cell . length ) elif cell . dtype is 1 : newcopy = stypes . SPICEDOUBLE_CELL ( cell . size ) elif cell . dtype is 2 : newcopy = stypes . SPICEINT_CELL ( cell . size ) else : raise... | Copy the contents of a SpiceCell of any data type to another cell of the same type . |
247,493 | def cpos ( string , chars , start ) : string = stypes . stringToCharP ( string ) chars = stypes . stringToCharP ( chars ) start = ctypes . c_int ( start ) return libspice . cpos_c ( string , chars , start ) | Find the first occurrence in a string of a character belonging to a collection of characters starting at a specified location searching forward . |
247,494 | def cposr ( string , chars , start ) : string = stypes . stringToCharP ( string ) chars = stypes . stringToCharP ( chars ) start = ctypes . c_int ( start ) return libspice . cposr_c ( string , chars , start ) | Find the first occurrence in a string of a character belonging to a collection of characters starting at a specified location searching in reverse . |
247,495 | def cvpool ( agent ) : agent = stypes . stringToCharP ( agent ) update = ctypes . c_int ( ) libspice . cvpool_c ( agent , ctypes . byref ( update ) ) return bool ( update . value ) | Indicate whether or not any watched kernel variables that have a specified agent on their notification list have been updated . |
247,496 | def cyllat ( r , lonc , z ) : r = ctypes . c_double ( r ) lonc = ctypes . c_double ( lonc ) z = ctypes . c_double ( z ) radius = ctypes . c_double ( ) lon = ctypes . c_double ( ) lat = ctypes . c_double ( ) libspice . cyllat_c ( r , lonc , z , ctypes . byref ( radius ) , ctypes . byref ( lon ) , ctypes . byref ( lat ) ... | Convert from cylindrical to latitudinal coordinates . |
247,497 | def cylrec ( r , lon , z ) : r = ctypes . c_double ( r ) lon = ctypes . c_double ( lon ) z = ctypes . c_double ( z ) rectan = stypes . emptyDoubleVector ( 3 ) libspice . cylrec_c ( r , lon , z , rectan ) return stypes . cVectorToPython ( rectan ) | Convert from cylindrical to rectangular coordinates . |
247,498 | def cylsph ( r , lonc , z ) : r = ctypes . c_double ( r ) lonc = ctypes . c_double ( lonc ) z = ctypes . c_double ( z ) radius = ctypes . c_double ( ) colat = ctypes . c_double ( ) lon = ctypes . c_double ( ) libspice . cyllat_c ( r , lonc , z , ctypes . byref ( radius ) , ctypes . byref ( colat ) , ctypes . byref ( lo... | Convert from cylindrical to spherical coordinates . |
247,499 | def dafac ( handle , buffer ) : handle = ctypes . c_int ( handle ) lenvals = ctypes . c_int ( len ( max ( buffer , key = len ) ) + 1 ) n = ctypes . c_int ( len ( buffer ) ) buffer = stypes . listToCharArrayPtr ( buffer ) libspice . dafac_c ( handle , n , lenvals , buffer ) | Add comments from a buffer of character strings to the comment area of a binary DAF file appending them to any comments which are already present in the file s comment area . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.