Plotting software


#1

In the plotting example notebook, you suggest that for our presentation we use a different plotting software, i’m wondering if you could give us some suggestions about which one to use. Also, how do we download the cube? I’ve been trying to do it from the ESDL FTP server put it asks for an user and password. Thank you!


#2

This really depends on the actual use case. As a usual workflow you would do some computations on the data cube and afterwards have a significantly reduced dataset from which you want to plot the results, maybe only a few set of geographical maps. So the idea was not to download the original data cube but only the results.

One way to produce nice plots from those results would be to use exportcube to save them as a regular NetCDF file and afterwards download the file through the jupyter lab file browser (right-click on the file -> download). Then you can use some NetCDF viewer to make nice plots of the data. However, this workflow is only feasible for data sizes of up to 100Mb. An example for this workflow (In Julia 1.1) would be the following:

using ESDL, Statistics
#Open a cube
c = Cube()
# Choose a subset
d = subsetcube(c,region="Poland", time=2001:2016, var = ["stemp","fapar_tip"])
# Calculate time means
means = mapslices(mean∘skipmissing, d, dims = "time")
# Now using ESDLPlots and plotMAP(means) is still possible
#And export the result to a netcdf file
exportcube(means,"meanmaps.nc")

The you browse to the final meanmaps.nc, download it and do the plot locally.

If your final result is rather a scatter plot, time series or bar graph etc then you can use one of Julia’s plotting packages directly, on the hub we have installed ECharts, GR and PyPlot.

Here would be a very minimal example workflow to accomplish this, first you do some compuation that results in a multivariate time series:

using ESDL, Statistics
c = Cube()
# Choose a subset
vars = ["stemp","air_temp","min_air_temp","max_air_temp"]
d = subsetcube(c,region="Poland", time=2001:2016, var = vars)
# Calculate time means
spacemeans = mapslices(mean ∘ skipmissing, d, dims=("lon","lat"))

Now, instead of using plotTS we decide to load the data into memory (check first if it fits) and then plot manually:

using GR
legend("T_surf", "T_air", "T_airmin", "T_airmax")
timesteps = getAxis("Time",spacemeans).values
#Load data and replace missing with NaN for the plotting package
arraydata = spacemeans[:,:]
arraydata =  replace(arraydata,missing=>NaN)
plot(arraydata)

Alternatively you can save the results as a CSV to download them through the jupyter interface:

# Install the CSV and DataFrames package
import Pkg; Pkg.add("CSV"); Pkg.add("DataFrames")
using CSV, DataFrames

# Load our data into a regular array and convert it to DataFrame
arraydata = spacemeans[:,:]
df = DataFrame(arraydata)
# Set the column names to our variable names
names!(df,Symbol.(vars))
# Add the time stamps fomr the Time Axis values
df.time = getAxis("Time",spacemeans).values
# Write the DataFrame as a CSV
CSV.write("temptimeseries.csv",df)

Then this file can be downloaded and processed on a local machine.

Be reminded again to check the sizes of your result data before doing these steps, and make sure they fit in memory.

I hope this helps answering your questions, feel free to ask if you are still unsure how to proceed.