TransWikia.com

Time series of NetCDF data in QGIS?

Geographic Information Systems Asked by mike snow on August 25, 2021

I am a newbie, trying to import a NetCDF file of satellite chlorophyll imagery into QGIS 3.8 (WIndows Standalone install).

I have added the raster layer and view the individual layers under “properties”.
I would like to use the time manger plugin to view a basic time series.
I try to add the raster (.nc) from the time manager settings and check the “layer is NetCDF file with time dimension”.
QGIS returns a message that I need to pip install netCDF for full support.

I have tried to do this but with the error log below:

C:Program FilesQGIS 3.8>py3_env

C:Program FilesQGIS 3.8>SET PYTHONPATH=

C:Program FilesQGIS 3.8>SET PYTHONHOME=C:PROGRA~1QGIS3~1.8appsPython37

C:Program FilesQGIS 3.8>PATH C:PROGRA~1QGIS3~1.8appsPython37;C:PROGRA~1QGIS3~1.8appsPython37Scripts;{app};C:PROGRA~1QGIS3~1.8appsPython27Scripts;C:PROGRA~1QGIS3~1.8bin;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSsystem32WBem;C:Program FilesRR-3.5.2binx64

C:Program FilesQGIS 3.8>pip3 install netCDF
Collecting netCDF
  Downloading https://files.pythonhosted.org/packages/dc/86/8f8e1b532a24f18d0487cd2a95c50ca7f1c41bc58bbba2d4bd6a9ce0fac9/netcdf-0.2.1.tar.gz (16.5MB)
     |████████████████████████████████| 16.5MB 2.2MB/s
Collecting numpy==1.8.0 (from netCDF)
  Downloading https://files.pythonhosted.org/packages/73/46/c5b5c61fccec607dad15a2d1f832dec1a8d094ea770d8f8e4a43abd8be7b/numpy-1.8.0.tar.gz (3.8MB)
     |████████████████████████████████| 3.8MB 656kB/s
    ERROR: Command errored out with exit status 1:
     command: 'c:osgeo4~1binpython3.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:UsersdrsnoAppDataLocalTemppip-install-w4_kbhronumpysetup.py'"'"'; __file__='"'"'C:UsersdrsnoAppDataLocalTemppip-install-w4_kbhronumpysetup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:UsersdrsnoAppDataLocalTemppip-install-w4_kbhronumpy
    Complete output (118 lines):
    'svnversion' is not recognized as an internal or external command,
    operable program or batch file.
    non-existing path in 'numpydistutils': 'site.cfg'
    F2PY Version 2
    blas_opt_info:
    blas_mkl_info:
      libraries mkl,vml,guide not found in ['C:PROGRA~1QGIS3~1.8appsPython37lib', 'C:']
      NOT AVAILABLE

    openblas_info:
      libraries openblas not found in ['C:PROGRA~1QGIS3~1.8appsPython37lib', 'C:']
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in ['C:PROGRA~1QGIS3~1.8appsPython37lib', 'C:']
      NOT AVAILABLE

    atlas_blas_info:
      libraries f77blas,cblas,atlas not found in ['C:PROGRA~1QGIS3~1.8appsPython37lib', 'C:']
      NOT AVAILABLE

    blas_info:
      libraries blas not found in ['C:PROGRA~1QGIS3~1.8appsPython37lib', 'C:']
      NOT AVAILABLE

    blas_src_info:
      NOT AVAILABLE

      NOT AVAILABLE

    'svnversion' is not recognized as an internal or external command,
    operable program or batch file.
    non-existing path in 'numpylib': 'benchmarks'
    lapack_opt_info:
    lapack_mkl_info:
    mkl_info:
      libraries mkl,vml,guide not found in ['C:PROGRA~1QGIS3~1.8appsPython37lib', 'C:']
      NOT AVAILABLE

      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in C:PROGRA~1QGIS3~1.8appsPython37lib
      libraries lapack_atlas not found in C:PROGRA~1QGIS3~1.8appsPython37lib
      libraries ptf77blas,ptcblas,atlas not found in C:
      libraries lapack_atlas not found in C:
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
      libraries f77blas,cblas,atlas not found in C:PROGRA~1QGIS3~1.8appsPython37lib
      libraries lapack_atlas not found in C:PROGRA~1QGIS3~1.8appsPython37lib
      libraries f77blas,cblas,atlas not found in C:
      libraries lapack_atlas not found in C:
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

    lapack_info:
      libraries lapack not found in ['C:PROGRA~1QGIS3~1.8appsPython37lib', 'C:']
      NOT AVAILABLE

    lapack_src_info:
      NOT AVAILABLE

      NOT AVAILABLE

    running egg_info
    running build_src
    build_src
    building py_modules sources
    creating build
    creating buildsrc.win-amd64-3.7
    creating buildsrc.win-amd64-3.7numpy
    creating buildsrc.win-amd64-3.7numpydistutils
    building library "npymath" sources
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    Running from numpy source directory.
    C:UsersdrsnoAppDataLocalTemppip-install-w4_kbhronumpynumpydistutilssystem_info.py:1522: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      warnings.warn(AtlasNotFoundError.__doc__)
    C:UsersdrsnoAppDataLocalTemppip-install-w4_kbhronumpynumpydistutilssystem_info.py:1531: UserWarning:
        Blas (http://www.netlib.org/blas/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [blas]) or by setting
        the BLAS environment variable.
      warnings.warn(BlasNotFoundError.__doc__)
    C:UsersdrsnoAppDataLocalTemppip-install-w4_kbhronumpynumpydistutilssystem_info.py:1534: UserWarning:
        Blas (http://www.netlib.org/blas/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [blas_src]) or by setting
        the BLAS_SRC environment variable.
      warnings.warn(BlasSrcNotFoundError.__doc__)
    C:UsersdrsnoAppDataLocalTemppip-install-w4_kbhronumpynumpydistutilssystem_info.py:1428: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      warnings.warn(AtlasNotFoundError.__doc__)
    C:UsersdrsnoAppDataLocalTemppip-install-w4_kbhronumpynumpydistutilssystem_info.py:1439: UserWarning:
        Lapack (http://www.netlib.org/lapack/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [lapack]) or by setting
        the LAPACK environment variable.
      warnings.warn(LapackNotFoundError.__doc__)
    C:UsersdrsnoAppDataLocalTemppip-install-w4_kbhronumpynumpydistutilssystem_info.py:1442: UserWarning:
        Lapack (http://www.netlib.org/lapack/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [lapack_src]) or by setting
        the LAPACK_SRC environment variable.
      warnings.warn(LapackSrcNotFoundError.__doc__)
    C:PROGRA~1QGIS3~1.8appsPython37libdistutilsdist.py:274: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

C:Program FilesQGIS 3.8>

One Answer

I performed a stand-alone installation of QGIS and got the same error.
I was doing a little research and I think the library to install is called netcdf4. In addition, I had to open the OSGeo4W console with administrator privileges.

The steps were as follows, if you want to test that they are a solution to your question:

  • Run with Administrator privileges the OSGeo4W console through the file C:Program FilesQGIS 3.8OSGeo4W.bat:
run o-help for a list of available commands
C:WindowsSystem32>
  • Navigate to the root:
C:WindowsSystem32>cd..

C:Windows>cd..

C:>
  • Temporarily set Python3 environment variables for this console through the py3_env command:
C:>py3_env

C:>SET PYTHONPATH=

C:>SET PYTHONHOME=C:PROGRA~1QGIS3~1.8appsPython37

C:>PATH C:PROGRA~1QGIS3~1.8appsPython37;C:PROGRA~1QGIS3~1.8appsPython37Scripts;{app};C:PROGRA~1QGIS3~1.8appsPython27Scripts;C:PROGRA~1QGIS3~1.8bin;C:WINDOWSsystem32;C:WINDOWS
  • Install the netcdf4 library trough the pip3 install netcdf4 command:
C:>pip3 install netcdf4
Collecting netcdf4
  Downloading https://files.pythonhosted.org/packages/e5/42/48bbea10b85bb5df618d53f2110fca98e6f8d66f3763540ae58eada9a1a2/netCDF4-1.5.2-cp37-cp37m-win_amd64.whl (3.1MB)
     |████████████████████████████████| 3.1MB 1.3MB/s
Collecting cftime (from netcdf4)
  Downloading https://files.pythonhosted.org/packages/e0/d7/1c3d2edc4cc6c3f16515811d3671dad4d355c6945b49eecbf448688c61c5/cftime-1.0.3.4-cp37-none-win_amd64.whl (206kB)
     |████████████████████████████████| 215kB 939kB/s
Requirement already satisfied: numpy>=1.7 in c:progra~1qgis3~1.8appspython37libsite-packages (from netcdf4) (1.16.3)
Installing collected packages: cftime, netcdf4
Successfully installed cftime-1.0.3.4 netcdf4-1.5.2

C:>

Answered by Gabriel De Luca on August 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP