Skip to content

Commit

Permalink
replace NCDatasets by NetCDF
Browse files Browse the repository at this point in the history
  • Loading branch information
JanJereczek committed Jun 26, 2024
1 parent 208278c commit bf3e3d6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 24 deletions.
26 changes: 7 additions & 19 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.0"
manifest_format = "2.0"
project_hash = "74234b000141fa9d8b5ea4c97d3dabdfb3c056bd"
project_hash = "817bbc907bc5a3001b6df197d52bcd86dbd70daf"

[[deps.AbstractFFTs]]
deps = ["LinearAlgebra"]
Expand Down Expand Up @@ -179,12 +179,6 @@ git-tree-sha1 = "389ad5c84de1ae7cf0e28e381131c98ea87d54fc"
uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82"
version = "0.5.0"

[[deps.CFTime]]
deps = ["Dates", "Printf"]
git-tree-sha1 = "5afb5c5ba2688ca43a9ad2e5a91cbb93921ccfa1"
uuid = "179af706-886a-5703-950a-314cd64e0468"
version = "0.1.3"

[[deps.CRC32c]]
uuid = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"

Expand Down Expand Up @@ -331,12 +325,6 @@ git-tree-sha1 = "08c8b6831dc00bfea825826be0bc8336fc369860"
uuid = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
version = "1.0.2"

[[deps.CommonDataModel]]
deps = ["CFTime", "DataStructures", "Dates", "Preferences", "Printf", "Statistics"]
git-tree-sha1 = "d6fb5bf939a2753c74984b11434ea25d6c397a58"
uuid = "1fbeeb36-5f17-413c-809b-666fb144f157"
version = "0.3.6"

[[deps.CommonSubexpressions]]
deps = ["MacroTools", "Test"]
git-tree-sha1 = "7b8a93dba8af7e3b42fecabf646260105ac373f7"
Expand Down Expand Up @@ -1365,12 +1353,6 @@ version = "0.3.4"
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
version = "2023.1.10"

[[deps.NCDatasets]]
deps = ["CFTime", "CommonDataModel", "DataStructures", "Dates", "DiskArrays", "NetCDF_jll", "NetworkOptions", "Printf"]
git-tree-sha1 = "a640912695952b074672edb5f9aaee2f7f9fd59a"
uuid = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
version = "0.14.4"

[[deps.NLSolversBase]]
deps = ["DiffResults", "Distributed", "FiniteDiff", "ForwardDiff"]
git-tree-sha1 = "a0b464d183da839699f4c79e7606d9d186ec172c"
Expand All @@ -1394,6 +1376,12 @@ git-tree-sha1 = "25abc2f9b1c752e69229f37909461befa7c1f85d"
uuid = "2f6b4ddb-b4ff-44c0-b59b-2ab99302f970"
version = "0.4.0"

[[deps.NetCDF]]
deps = ["DiskArrays", "NetCDF_jll"]
git-tree-sha1 = "c8ec10c6b72e35f7020b83330f8054908ba454eb"
uuid = "30363a11-5582-574a-97bb-aa9a979735b9"
version = "0.11.8"

[[deps.NetCDF_jll]]
deps = ["Artifacts", "Blosc_jll", "Bzip2_jll", "HDF5_jll", "JLLWrappers", "LibCURL_jll", "Libdl", "OpenMPI_jll", "XML2_jll", "Zlib_jll", "Zstd_jll", "libzip_jll"]
git-tree-sha1 = "a8af1798e4eb9ff768ce7fdefc0e957097793f15"
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DrWatson = "634d3b9d-ee7a-5ddf-bec9-22491ea816e1"
GeoStats = "dcc97b0b-8ce5-5539-9008-bb190f959ef6"
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
LazyGrids = "7031d0ef-c40d-4431-b2f8-61a8d2f650db"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
NetCDF = "30363a11-5582-574a-97bb-aa9a979735b9"
Proj = "c94c279d-25a6-4763-9509-64d165bea63e"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ which activates the project, imports important packages and enables local path h

This repository aims to centralise the julia regridding routines used within the palma-ice group. The internal workflow can be summarized as:

1. Load the source data on the source grid by using `NCDatasets` and define an interpolator by using `Interpolations.jl`. We here require the user to have preprocessed their data into a NetCDF file.
1. Load the source data on the source grid by using `NetCDF` and define an interpolator by using `Interpolations.jl`. We here require the user to have preprocessed their data into a NetCDF file.
1. Define the target grid. For this we use `LazyGrids.jl`, which is memory-efficient and simple to use.
2. Compute the associated coordinates on the projection where the source data is defined. For this we use `Proj.jl` which offers a wide range of transformations that can be easily adjusted through keyword arguments.
3. Pass the target grid to the interpolator.

We propose to illustrate this with an example, where the geothermal heat flux data from Hazzard and Richards (2024) is regridded from lon-lat to stereographic:

```julia
using CairoMakie, Interpolations, NCDatasets, Proj
using CairoMakie, Interpolations, Proj

# Step 1
filepath = datadir("BCs/Hazzard-Richards-2024/HR24_GHF_mean.nc")
Expand Down Expand Up @@ -72,7 +72,7 @@ X, Y = ndgrid(x, y)

prob = RegriddingProblem(
source_file = "BCs/Hazzard-Richards-2024/HR24_GHF_mean.nc",
dims = ["x", "y"],
source_dims = ["x", "y"],
vars = ["z"],
source_gridname = "EPSG:4326",
target_gridname = "+proj=stere +lat_0=-90 +lat_ts=-80",
Expand Down
2 changes: 1 addition & 1 deletion scripts/intro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using CairoMakie
using GeoStats
using Interpolations
using LazyGrids
using NCDatasets
using NetCDF
using Unitful
using Proj

Expand Down

0 comments on commit bf3e3d6

Please sign in to comment.