-
Notifications
You must be signed in to change notification settings - Fork 37
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
Preliminary outline for reading/writing docs #536
base: main
Are you sure you want to change the base?
Conversation
Dont worry about the tests ucdavis (worldclim) is down, as usual |
Note we cant write to hdf5 ;) |
# # write Raster to a JDL2 file. | ||
|
||
# JLD2 saves and loads Julia data structures in a format comprising a subset of HDF5, | ||
# without any dependency on the HDF5 C library. The save and load functions, provided | ||
# by FileIO, provide a mechanism to read and write data from a JLD2 file. | ||
Pkg.add("FileIO"); | ||
using FileIO | ||
|
||
filename = tempname() * ".jld2" | ||
save(filename, ras) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be a bit leery of serializing rasters using JLD2, since it's not robust if anything in the stack changes (DD, DiskArrays, etc). Maybe we should add a warning that this is only suitable for extremely short term storage?
filename = tempname() * ".grd" | ||
write(filename, ras) | ||
|
||
# # write Raster using GDAL[requires adding ArchGDAL.jl] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# # write Raster using GDAL[requires adding ArchGDAL.jl] | |
# # Write Raster using GDAL (requires ArchGDAL.jl) |
# create a Raster | ||
ras = Raster(rand(lon, lat); crs=proj) # this generates random numbers with the dimensions given | ||
|
||
# # write Raster to a grd file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# # write Raster to a grd file | |
# # Write Raster to a `.grd` file |
# Some metadata may be lost in formats that store little metadata, or where | ||
# metadata conversion has not been completely implemented. | ||
|
||
# # create a Raster dataset for saving |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# # create a Raster dataset for saving | |
# # Create a Raster to save |
using Rasters | ||
|
||
# specify the coodinate reference system [crs]. | ||
proj = "+proj=longlat +datum=WGS84 +no_defs +type=crs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be wrapped in GFT.ProjString
@@ -0,0 +1,73 @@ | |||
# # Writing rasters to Disk | |||
|
|||
# Rasters.jl supports writing datasets to disk in several differnt formats. grd files are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Rasters.jl supports writing datasets to disk in several differnt formats. grd files are | |
# Rasters.jl supports writing datasets to disk in several different formats. `.grd` files are |
# # Writing rasters to Disk | ||
|
||
# Rasters.jl supports writing datasets to disk in several differnt formats. grd files are | ||
# currently the only supported file format that does not require loading an extension. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# currently the only supported file format that does not require loading an extension. | |
# supported with no extra steps, but all others require loading an extension. |
This is a preliminary edit to update the reading and writing docs.
I'm hoping to get help getting the NCDatasets and HDF5 examples working that are located at the end of the
writing.jl
file.