Animations
Pass in an Observable
t = Observables(1)
-field = @lift(view(ds(time=$t)["pv"])
-fig,ax,plt = plot(field)
Then animate like
for i in 1:100
- t[]=i
- sleep(0.01)
-end
-
diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 2c8656a..b3d9cbe 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.3","generation_timestamp":"2023-10-16T07:39:17","documenter_version":"1.1.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.3","generation_timestamp":"2023-10-18T23:01:07","documenter_version":"1.1.1"}} \ No newline at end of file diff --git a/dev/animations/index.html b/dev/animations/index.html deleted file mode 100644 index 0a8007c..0000000 --- a/dev/animations/index.html +++ /dev/null @@ -1,8 +0,0 @@ - -
Pass in an Observable
t = Observables(1)
-field = @lift(view(ds(time=$t)["pv"])
-fig,ax,plt = plot(field)
Then animate like
for i in 1:100
- t[]=i
- sleep(0.01)
-end
-
Settings
This document was generated with Documenter.jl version 1.1.1 on Monday 16 October 2023. Using Julia version 1.9.3.
ERA5 data can be downloaded from the Climate Data Store. Requires an account
Click download data
in one of the datasets to get an overview of the available data. After making a selection click Show API request
which will give a Python script to download the data. You can also use CDSAPI.jl julia package
using CDSAPI
+Getting data · NCPlots.jl Getting data
ERA5
ERA5 data can be downloaded from the Climate Data Store. Requires an account
- Complete ERA5 global atmospheric reanalysis
- ERA5 hourly data on pressure levels from 1940 to present,
- ERA5 hourly data on single levels from 1940 to present
- ERA5-Land hourly data from 1950 to present
Click download data
in one of the datasets to get an overview of the available data. After making a selection click Show API request
which will give a Python script to download the data. You can also use CDSAPI.jl julia package
using CDSAPI
year = 2020
month = 4 # use e.g. 1:12 for all months
@@ -25,4 +25,4 @@
),
"era5_pressure_levels_$(join(variable,"_")).nc"
)
-
Arctic regional reanalysis
Arctic regional reanalysis (CARRA) can be download from the climate data store
- Artic regional reanalysis on pressure levels from 1991 to present
- Arctic regional reanalysis on model levels from 1991 to present
MetCoop
Harmonie Arome NetCDF file from Met Norway: todo
Settings
This document was generated with Documenter.jl version 1.1.1 on Monday 16 October 2023. Using Julia version 1.9.3.
+
Arctic regional reanalysis (CARRA) can be download from the climate data store
Harmonie Arome NetCDF file from Met Norway: todo
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.
These examples use NetCDF files from the docs/src/assets
directory. For the animations download larger datasets as exlained in the Getting data section.
using NCPlots, GLMakie, NCDatasets
-ds = Dataset("assets/era5_pv_z_500hPa.nc")
-pv = view(ds, time=1)["pv"]
-fig, ax, plt = plot(pv, colormap=:RdBu, colorrange=(-3e-6,3e-6))
-save("assets/era5_pv_docs.png", fig) # hide
Access properties specular
diffuse
etc. in the returned plt
.
Explain how to update camera, change lightposition
See docs/plotlogo.jl
for an example
Multiply x
, y
, z
by geopotential height
See plot geopotential height. Color show temperature increments from data assimilation
archive="/lustre/storeB/immutable/archive/projects/metproduction/MEPS/"
-ds = Dataset("$archive/2023/10/01/meps_det_2_5km_20231001T00Z.nc")
-field = view(ds,hybrid=65,time=1)["air_temperature_ml"]
-plot(field)
To make these animations use Observables and @lift
to lift the dataset view e.g.
ds = Dataset(...)
-t = Observable(1)
-pv = @lift(view(ds,time=$t)["pv"])
-plot(pv)
Updating t
wil update the plot e.g.
for i=1:100
- t[] = i
- sleep(0.01)
-end
You can access eyeposition in ax.scene
and update in the for loop
Settings
This document was generated with Documenter.jl version 1.1.1 on Monday 16 October 2023. Using Julia version 1.9.3.
To make these animations use Observables and @lift
to lift the dataset view e.g.
ds = Dataset(...)
+t = Observable(1)
+pv = @lift(view(ds,time=$t)["pv"])
+plot(pv)
Updating t
wil update the plot e.g.
for i=1:100
+ t[] = i
+ sleep(0.01)
+end
You can access eyeposition in ax.scene
and update in the for loop
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.
These examples use NetCDF files from the docs/src/assets
directory. For the animations download larger datasets as exlained in the Getting data section.
using NCPlots, GLMakie, NCDatasets
+ds = Dataset("assets/era5_pv_z_500hPa.nc")
+pv = view(ds, time=1)["pv"]
+fig, ax, plt = plot(pv, colormap=:RdBu, colorrange=(-3e-6,3e-6))
+save("assets/era5_pv_docs.png", fig) # hide
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.
Multiply x
, y
, z
by geopotential height
See plot geopotential height. Color show temperature increments from data assimilation
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.
archive="/lustre/storeB/immutable/archive/projects/metproduction/MEPS/"
+ds = Dataset("$archive/2023/10/01/meps_det_2_5km_20231001T00Z.nc")
+field = view(ds,hybrid=65,time=1)["air_temperature_ml"]
+plot(field)
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.
Access properties specular
diffuse
etc. in the returned plt
.
Explain how to update camera, change lightposition
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.
Example reading from MEPS archive at MET Norway
using Glob, NCDatasets, NCPlots, GLMakie
+
+archive="/lustre/storeB/immutable/archive/projects/metproduction/MEPS/2023/01/30"
+
+files = glob("meps_det_2_5km*.nc", archive) # use e.g. "....*00.nc" to only match files with 00:00 UTC
+
+ds = NCDatasets.Dataset(files, aggdim="cycle", isnewdim=true, constvars=["x","y","hybrid","time"],deferopen=false)
+
+fig = Figure()
+fcint = 3; llmax=66; nlev=65
+
+
+tsl, lsl,csl = SliderGrid(fig[2,1],
+ (label="LL",range=1:(llmax-fcint),startvalue=1),
+ (label="Level",range=nlev:-1:1,startvalue=nlev),
+ (label="Cycle",range=2:length(files),startvalue=2),
+ tellheight=false,
+ width=350
+)
+ax= Axis(fig[1,2])
+
+varname = "air_temperature_ml"
+var = ds[varname]
+
+dsv = @lift(var[:,:,$(lsl.value),$(tsl.value),$(csl.value)] -
+ var[:,:,$(lsl.value),$(tsl.value)+3,$(csl.value)-1]
+ )
+
+title = @lift(string(Analysis increment, " " ,varname, basename(files[$(cycle_sl.value)]))
+subtitle = @lift(string(" Level ", $(lsl.value), "forecast", $(tsl.value)-1, " Hour") )
+
+heatmap!(ax,dsv,colormap=:RdBu,colorrange=(-2,2))
+Label(fig[0,:],label,tellwidth=false)
+Label(fig[1,:],label,tellwidth=false)
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.
See docs/plotlogo.jl
for an example
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.
+crangedict = Dict(
+ "pv" => (-2e-6,2e-6),
+ "z" => (20000.0,50000.0)
+)
+
+fig = Figure()
+
+menu = Menu(fig[1,1],options=setdiff(keys(ds),dimnames(ds)))
+menu2 = Menu(fig[1,2], options=colorschemes)
+sl = SliderGrid(fig[2,1],
+ (label="time", range=1:length(ds["time"]),startvalue=1,format = x-> Dates.format(ds["time"][x],"yyyymmdd-HH"))
+ )
+ax = LScene(fig[3,1], show_axis=false)
+colorrange=@lift(crangedict($(menu.selection)))
+colormap=@lift(colorschem)
+
+ds = Dataset("...")
+dsv = @lift(view(ds,time=$(sl.sliders[1].value))[$(menu.selection)])
+plotvar!(ax,dsv,colorrange=colorrange,colormap=:RdBu)
+
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.
NCPlots is a Julia package for plotting (meteorological) data on the sphere. Datasets should conform to the CF convention and implement the CommonDataModel.jl interface like NCDatasets and GRIBDatasets
See here for some examples See Getting data how to obtain ERA5 and CARRA data.
NCPlots is in the Harmonie registry. Add the Harmonie registry (hit ]
in the Julia REPL to enter package mode).
pkg> registry add https://github.com/Hirlam/HarmonieRegistry.git
Then install NCPlots with
pkg> add NCPlots
Variables should only have dimensions longitude
and latitude
. If there are additional dimensions create a view e.g. for a dataset ds
that contains a variable pv
where pv
in addition to longitude
and latitude
also has dimension time
do
julia> using NCPlots, GLMakie, NCDatasets
+Home · NCPlots.jl NCPlots
NCPlots is a Julia package for plotting (meteorological) data on the sphere. Datasets should conform to the CF convention and implement the CommonDataModel.jl interface like NCDatasets and GRIBDatasets
See here for a basic example and Getting data how to obtain ERA5 and CARRA data.
Installation
NCPlots is in the Harmonie registry. Add the Harmonie registry (hit ]
in the Julia REPL to enter package mode).
pkg> registry add https://github.com/Hirlam/HarmonieRegistry.git
Then install NCPlots with
pkg> add NCPlots
Data requirements
Variables should only have dimensions longitude
and latitude
. If there are additional dimensions create a view e.g. for a dataset ds
that contains a variable pv
where pv
in addition to longitude
and latitude
also has dimension time
do
julia> using NCPlots, GLMakie, NCDatasets
julia> ds = Dataset("era5_pressure_levels_geopotential_pv.nc")
julia> pv = view(ds,time=1)["pv"]
pv (1440 × 721)
@@ -16,4 +16,4 @@
plot(pv)
The plot will update automatically with
t[]=2
to make a basic animation you can do
for ti = 1:100
t[]=ti
sleep(0.01)
-end
Settings
This document was generated with Documenter.jl version 1.1.1 on Monday 16 October 2023. Using Julia version 1.9.3.
+end
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.
See Makie Camera3D documentation
Key | Translation |
---|---|
r | Up |
f | Down |
a | Left |
d | Right |
w | Forward |
s | Backward |
PgUp | Strech. Moving eyepostion away from lookat. |
PgDn | Contract. moving eyeposition towards lookat. |
Key | Pan, Tilt, Roll |
---|---|
j | Pan left |
l | Pan right |
i | Tilt up |
k | Tilt down |
e | Roll clockwise |
q | Roll counter |
Key | Zoom |
---|---|
u | zoom in (enlarge, via fov). |
o | zoom out (shrink, via fov). |
Settings
This document was generated with Documenter.jl version 1.1.1 on Monday 16 October 2023. Using Julia version 1.9.3.
See Makie Camera3D documentation
Key | Translation |
---|---|
r | Up |
f | Down |
a | Left |
d | Right |
w | Forward |
s | Backward |
PgUp | Strech. Moving eyepostion away from lookat. |
PgDn | Contract. moving eyeposition towards lookat. |
Key | Pan, Tilt, Roll |
---|---|
j | Pan left |
l | Pan right |
i | Tilt up |
k | Tilt down |
e | Roll clockwise |
q | Roll counter |
Key | Zoom |
---|---|
u | zoom in (enlarge, via fov). |
o | zoom out (shrink, via fov). |
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.
NCPlots.plot
— Functionfig,ax,plt = plot(var)
Plots variable var
on the sphere. Returns fig
ax
and plt
.
NCPlots.plotvar!
— Functionplotvar!(ax,var)
Plots variables var
into axis ax
NCPlots.addequator!
— Functionaddequator!(ax; lat=0, kwargs...)
Adds equator to axis ax
NCPlots.addmeridian!
— Functionaddmeridian!(ax; lon=0, kwargs...)
Adds meridian at lon=0
to axis ax
NCPlots.lonlat2xyz
— Functionx,y,z = lonlat2xyz(lons,lats)
Convert lons
, lats
to x
,y
,z
coordinates.
lons
, lats
can be either Vector
or Matrix
(for irregular grids in LAM models )
NCPlots.lonpadview
— Functionlonpadview(data::Matrix)
-lonpadview(data::Vector)
Returns a view
of data
with the first row (assumed to be the longitude dimensions repeated at the end.
NCPlots.isperiodiclon
— Functionisperiodiclon(lons)
Returns true
if lons
is a Vector
and lons
is periodic. false
if lons is a Matrix
(irregular grid LAM model)
Settings
This document was generated with Documenter.jl version 1.1.1 on Monday 16 October 2023. Using Julia version 1.9.3.
NCPlots.plot
— Functionfig,ax,plt = plot(ds)
Plots dataset ds
fig,ax,plt = plot(var)
Plots variable var
on the sphere. Returns fig
ax
and plt
.
NCPlots.plotvar!
— Functionplotvar!(ax,var)
Plots variables var
into axis ax
NCPlots.addequator!
— Functionaddequator!(ax; lat=0, kwargs...)
Adds equator to axis ax
NCPlots.addmeridian!
— Functionaddmeridian!(ax; lon=0, kwargs...)
Adds meridian at lon=0
to axis ax
NCPlots.lonlat2xyz
— Functionx,y,z = lonlat2xyz(lons,lats)
Convert lons
, lats
to x
,y
,z
coordinates.
lons
, lats
can be either Vector
or Matrix
(for irregular grids in LAM models )
NCPlots.lonpadview
— Functionlonpadview(data::Matrix)
+lonpadview(data::Vector)
Returns a view
of data
with the first row (assumed to be the longitude dimensions repeated at the end.
NCPlots.isperiodiclon
— Functionisperiodiclon(lons)
Returns true
if lons
is a Vector
and lons
is periodic. false
if lons is a Matrix
(irregular grid LAM model)
Settings
This document was generated with Documenter.jl version 1.1.1 on Wednesday 18 October 2023. Using Julia version 1.9.3.