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

Preliminary outline for reading/writing docs #536

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alex-s-gardner
Copy link
Contributor

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.

@rafaqz
Copy link
Owner

rafaqz commented Oct 6, 2023

Dont worry about the tests ucdavis (worldclim) is down, as usual

@rafaqz
Copy link
Owner

rafaqz commented Oct 7, 2023

Note we cant write to hdf5 ;)

Comment on lines +63 to +72
# # 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)
Copy link
Collaborator

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]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# # 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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# # 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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# # 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"
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# 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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# 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.

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.

3 participants