Create CovJSON files from common scientific data formats(e.g NetCDF)
If you already have netCDF4 and hdf5 installed, open up a command line and type the following:
$ pip install pycovjson
If not, you will need to download conda for your operating system, details of how to do this can be found here. After you have installed conda, type the following in the command line:
$ conda install netcdf4
$ pip install pycovjson
Installing pycovjson
from the conda-forge
channel can be achieved by adding conda-forge
to your channels with:
conda config --add channels conda-forge
Once the conda-forge
channel has been enabled, pycovjson
can be installed with:
conda install pycovjson
It is possible to list all of the versions of pycovjson
available on your platform with:
conda search pycovjson --channel conda-forge
Command line interface:
pycovjson-convert accepts 6 parameters, and can be run as followed
$ pycovjson-convert -i *name of input file(NetCDF)* -o *name of output file* -v *variable* [-t] [-s] *tile shape as list*
On running the script, a CoverageJSON file will be generated.
pycovjson-viewer accepts up to 2 parameters:
$ pycovjson-viewer [*-v display variable information only*] on running will display information about the input file.
To be use in conjunction with pycovjson-convert.
$ pycovjson-viewer *name of netCDF file*
$ pycovjson-convert -i melodies_landcover.nc -o coverage.json -v land_cover
Once pycovjson is installed, type the following at the top of your code:
import pycovjson.convert
Once imported you can then use the convert function within your projects.
pycovjson.convert('polcoms.nc', 'coverage.covjson', [sst])
This will generate a file called coverage.covjson in the directory where the script is located.
Currently only NetCDF is supported. In order to support other formats only the reader function would need to be changed, as the pycovjson loads data into python data structures before writing to CovJSON.
The project roadmap can be found here.