Extracting data from netcdf stacked file

Hi everybody,
I have several nc files from AgERA5 database and I want to do 2 main tasks:
1- stack them in a unique nc file; and
2- extract the data series from a specific pair of lat lon coordinates from the stacked nc file.

Some ideas how to do it?

Many thanks in advance,

LM

Don’t know the structure of those AgERA5 nc files but if they are 2D you may be able to do that with GMT.jl. Use the stackgrids function to create the cube and then use grdinterpolate to do the interpolation. Sorry, this module has not yet seen its manual fully translated to GMT.jl so one still have to resort to the original GMT C man or the short doc provided by ?grdinterpolate. The use should something like:

D = grdinterpolate("the_cube_file_name", track=(x,y))

or, if the cube is not too big, load it with into Julia with

C = grdinterpolate("the_cube_file_name");

and next do the interpolation with

D = grdinterpolate([x y], C)

Note, if you are on Linux you’ll probably will need to install GMT (the C lib) manually before installing GMT.jl (sorry, not my fault), or use Julia 1.9alpha.

How does AgERA5 differ from ECMWF ERA5? I guess, you could also probably use cdo (its written in Fortran with CPython interface [Climate Data Operators - Wikipedia]. Works pretty well with Julia thanks to PyCall.jl and PythonCall.jl. EDIT: Just took a quick look at AgERA5. I believe, provided suggestion, even though, not pure Julia, should work.

1 Like