--
You received this message because you are subscribed to the Google Groups "xarray" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xarray+unsubscribe@googlegroups.com.
To post to this group, send email to xar...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xarray/1a9c1cbd-7109-4872-93c8-f93418816180%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "xarray" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xarray/QWl90sCCQyw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xarray+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xarray/CAJAZx5AFS3YDjjFuSpw4Z3ZwthbkvkB9BzaUQy%2Bwgcy01hOT0Q%40mail.gmail.com.
Jody,Unfortunately this holy grail regridding package doesn't exist yet.I have done similar things to what you are describing on out of core datasets. The trick I have used is to work directly on the dask layer.You can access the underlying dask arrays in a chunked xarray dataset via the dataset.variable.data syntax.Then you can apply some arbitrary function over the chunks using `map_blocks`.(xarray `apply` will do something similar)In your case, if you chunk your data by time and z, you can then apply the interpolation routine to each 2D slice.Another cool trick I discovered was to use a custom "store" for dask to write my data out to disk in a streaming fashion. Maybe you can modify this routine to work for you:Cheers,Ryan
On Thu, Jan 26, 2017 at 12:52 PM, Jody Klymak <jkl...@gmail.com> wrote:
Hi all,Not even sure if xarray is the right tool for this, but it sounds like many of you have thought about this problem...I'm using the MITgcm and Ryan's very nice xmitgcm package to read "mds" files (basically flat bianry files for each variable).I have run the model on a regular x/y grid (Cartesian co-ordinates) and now wish to write initialization files from this run onto a stretched horizontal grid with more resolution in the center and less towards the boundaries. The output should be in the flat binary file format (rather than netcdf, for instance).Any advice on the doing the above is welcome.My strategy was to read each field in and then inrepolate in x and then in y (its not going to matter too much that there will be some aliasing in the coarse regions) and then write the files. The input files are 800 Mb and the output 1.6 Gb, so its doable in memory. I was just going to run `np.interp` in y and then in x for each z level.Is there a more clever way to do the above? Perhaps one that would scale up to memory footprints that are much larger? I apprecaite there is a regridding package being considered, but for now am I missing anything obvious?Thanks a lot, Jody
--
You received this message because you are subscribed to the Google Groups "xarray" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xarray+un...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to xarray+unsubscribe@googlegroups.com.
To post to this group, send email to xar...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xarray/d7fac02b-c79f-42c3-ac9e-20f0b754fc08%40googlegroups.com.
The block of size (1, 1, 1, 1) was Dask.array trying to guess what the output dtype of your function was by feeding it a little piece of data. You can avoid this by specifying the dtype explicitly. See http://dask.pydata.org/en/latest/array-api.html#dask.array.core.map_blocks
Another cool trick I discovered was to use a custom "store" for dask to write my data out to disk in a streaming fashion. Maybe you can modify this routine to work for you: