exactextract icon indicating copy to clipboard operation
exactextract copied to clipboard

only the data of the first date was extracted from nc file

Open kongdd opened this issue 3 years ago • 7 comments

One of my nc file has the dimension of [nlon, nlat, ntime], ntime = 365. However, when using exactextract, only the data of the first date was extracted.

kongdd avatar Aug 01 '20 08:08 kongdd

How did you load the nc file?

dbaston avatar Aug 01 '20 12:08 dbaston

By the following command:

exactextract -r temp:NETCDF:ET_LISFLOOD.nc:Evap \
    -p Selected_Elasticity_10YThre.shp \
    -f name -s "mean(temp)" -o ET_LISFLOOD2.csv

kongdd avatar Aug 01 '20 12:08 kongdd

Oops, I saw this in my email and thought it was referring to https://github.com/isciences/exactextractr . Currently the command-line version processes only a single band. You can specify the band manually, e.g., temp:NETCDF:ET_LISFLOOD.nc:Evap[2], and loop over all bands.

If you want to easily process all of the bands at once, maybe give the R package a try.

Here is a minimal example of the R usage: https://gist.github.com/dbaston/26e8b739dd2549cf1a4c9718981354d3

dbaston avatar Aug 01 '20 12:08 dbaston

Thanks for your script.

kongdd avatar Aug 02 '20 00:08 kongdd

So, is there any solution for exactextract to retrieve data from multiple dates from a netcdf file?

relima avatar Nov 22 '21 23:11 relima

Currently you'd need to either loop through the bands or use the R package.

dbaston avatar Nov 22 '21 23:11 dbaston

Got it. The program is awesome -- very fast. For python it may be a good replacement for rasterstats, which is very good too, but terrible slow.

relima avatar Nov 22 '21 23:11 relima