Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jgrss/store time series #315

Closed
wants to merge 13 commits into from
Closed

jgrss/store time series #315

wants to merge 13 commits into from

Conversation

jgrss
Copy link
Owner

@jgrss jgrss commented May 5, 2024

What is this PR changing?

  • Adds support for Dask client in save()
  • Adds support to write (time x band x height x width)-shaped arrays by scattering the band or time dimension to separate files

@mmann1123
Copy link
Collaborator

I am going to try to take a look at this.


DF = gpd.GeoDataFrame(geometry=[shape(geojson)], crs=4326)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be updated to shape(search_geojson) I think.

@@ -28,15 +35,47 @@
],
}

EPSG = 8857
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its failing without this line

Copy link
Collaborator

@mmann1123 mmann1123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The client save seems to be working well. Seems like you inadvertently removed some lines that muck up stac tests. I added comments to address

@jgrss jgrss marked this pull request as ready for review May 6, 2024 08:21
)

if hasattr(self.data, "_FillValue"):
nodata = self.data.attrs["_FillValue"]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer a user argument.

if self.scatter is None:
band_count = self.data.gw.nbands
else:
if self.scatter == 'band':
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File scattering is new.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is file scattering?

memory_limit="1GB",
) as cluster:
with Client(cluster) as client:
time_mean.gw.save(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the test using a client.

client (Optional[Client object]): A ``dask.distributed.Client`` client object to persist data.
Default is None.
compute (Optinoal[bool]): Whether to compute and write to ``filename``. Otherwise, return
the ``dask`` task graph. If ``True``, compute and write to ``filename``. If ``False``,
return the ``dask`` task graph. Default is ``True``.
tags (Optional[dict]): Metadata tags to write to file. Default is None.
compress (Optional[str]): The file compression type. Default is 'none', or no compression.

.. note::
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmann1123 👀

def test_client_save(self):

with LocalCluster(
processes=False,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary to write to compressed file.

filename=out_path,
overwrite=True,
tags={"TEST_METADATA": "TEST_VALUE"},
compress="lzw",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compression should be okay.

@jgrss
Copy link
Owner Author

jgrss commented May 18, 2024

I merged this into #319.

@jgrss jgrss closed this May 18, 2024
@jgrss jgrss deleted the jgrss/store_time_series branch May 18, 2024 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants