<jupyter_start><jupyter_text>Dask<jupyter_code>coords = numpy.array([lat, lon])
coords_d = dask.array.from_array(coords, chunks=(2,500,1354))
coords_d
def stare(coords):
    return pystare.from_latlon2D(coords[0], 
                                 coords[1], adapt_resolution=True)
s_d = coords_d.map_blocks(stare, drop_axis=[0], 
                            chunks=(100, 1354), dtype='int64')
s_d = s_d.compute()<jupyter_output><empty_output><jupyter_text>Xarray Ufunc<jupyter_code>lat_x = xarray.DataArray(lat, dims=['x', 'y']).chunk({'x': 500})
lon_x = xarray.DataArray(lon, dims=['x', 'y']).chunk({'x': 500})
start = datetime.datetime.now()
s_d = xarray.apply_ufunc(pystare.from_latlon2D, 
                         lat_x,
                         lon_x,
                         dask='parallelized',
                         output_dtypes=[numpy.int64])

sids = numpy.array(s_d)
print(datetime.datetime.now()-start)
sids<jupyter_output><empty_output><jupyter_text>Write Sidecar<jupyter_code>import netCDF4
rootgrp = netCDF4.Dataset('test.nc', "w", format="NETCDF4")

rootgrp.close()<jupyter_output><empty_output><jupyter_text>Dask DataFrame<jupyter_code>band1 = hdf.select('Water_Vapor_Infrared').get().astype(numpy.double)
lat = hdf.select('Latitude').get().astype(numpy.double)
import pandas
df = pandas.DataFrame({'stare': sids.flatten(), 'band1': band1.flatten()})
ddf = dask.dataframe.from_pandas(df, npartitions=4)
ddf.set_index('stare')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15842924847664183, 'fraction_numerical': 0.025050778605280974, 'mean_word_length': 4.185964912280702, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '378597', 'license': 'MIT', 'n_tokens_mistral': 594, 'n_tokens_neox': 570, 'n_words': 65, 'path': 'examples/dask_df.ipynb', 'repo_name': 'SpatioTemporal/STAREPandas', 'size': '1477'}