Skip to content

Error while executing python script to retrieve netCDF4 from OpenDap. Error Message: Error:curl error: Problem with the SSL CA cert (path? access rights?) running inside a docker file #1199

Open

Description

@advapiIT

Hello,
I have to say I'm new to NetCDF4 and python in general, I've been asked to create a tool that converts from opendap file to .nc in order to process them.
I've got my application (.NET 6) that runs and execute a python script that performs the conversion. On windows env everything works fine.

When I run inside a container I got the following error

Error while executing python script to retrieve netCDF4 from OpenDap. Error Message: Error:curl error: Problem with the SSL CA cert (path? access rights?)

The URL I'm trying to get is https://thredds.met.no/thredds/dodsC/arcticdata/obsSynop/04320 .

Is there a way I can tell NetCDF to accept all certificates?
If I do it from inside the container

curl https://thredds.met.no/thredds/dodsC/arcticdata/obsSynop/04320.html it shows the data...so curl seems to work and doen't show anything about certficiate issue

I'm using latest version of NetCDF 1.6.1
and python 3.9

I do this inside my container to install python3/netdf

RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y python3
RUN apt-get install -y python3-pip
RUN pip3 install netCDF4

Activity

  1. jswhit commented on Oct 12, 2022

    @jswhit
    Collaborator

    works for me

    >>> from netCDF4 import Dataset
    >>> nc = Dataset('https://thredds.met.no/thredds/dodsC/arcticdata/obsSynop/04320')
    >>> nc
    <class 'netCDF4._netCDF4.Dataset'>
    root group (NETCDF3_CLASSIC data model, file format DAP2):
        featureType: timeSeries
        title: SYNOP data from station DANMARKSHAVN
        abstract: Synoptic meteorological measurements from DANMARKSHAVN
        institution: Norwegian Meteorological Institute
        contact: o.godoy@met.no
        PI_name: Øystein Godøy
        Conventions: CF-1.4
        activity_type: Land station
        topiccategory: ClimatologyMeteorologyAtmosphere
        keywords: Atmospheric Observation Temperature Humidity Clouds Pressure Precipitation Wind SYNOP
        gcmd_keywords: Atmosphere > Atmospheric Pressure > Surface Pressure
    Atmosphere > Atmospheric Temperature > Surface Air Temperature
    Atmosphere > Atmospheric Water Vapor > Humidity
    Atmosphere > Clouds > Cloud Types
    Atmosphere > Clouds > Cloud Amount/Frequency
    Atmosphere > Precipitation > Precipitation Amount
    Atmosphere > Atmospheric Winds > Surface Winds
    Cryosphere > Snow/Ice > Snow Depth
        project_name: ACCESS
        area: Northern Hemisphere
        product_name: SYNOP
        distribution_statement: Free
        history: 2022-01-02 revision
        southernmost_latitude: 76.76944
        northernmost_latitude: 76.76944
        westernmost_longitude: -18.66806
        easternmost_longitude: -18.66806
        start_date: 2021-01-01 00:00:00 UTC
        stop_date: 2021-12-31 23:00:00 UTC
        DODS.strlen: 5
        DODS.dimName: name_strlen
        dimensions(sizes): maxStrlen64(64), obs(16955)
        variables(dimensions): float32 latitude(), float32 longitude(), float32 alt(), |S1 station_wmonr(maxStrlen64), float64 obs(obs), float32 TA(obs), float32 TD(obs), float32 TAX_12(obs), float32 TAN_12(obs), float32 TW(obs), float32 PR(obs), float32 PO(obs), float32 PP(obs), int32 AA(obs), float32 RR_1(obs), float32 RR_6(obs), float32 RR_12(obs), float32 RR_24(obs), float32 SA(obs), int32 EE(obs), float32 FF(obs), float32 DD(obs), float32 FG_010(obs), float32 FG(obs), float32 VV(obs), float32 NN(obs), float32 HL(obs), int32 CL(obs), int32 CM(obs), int32 CH(obs), float32 UU(obs), int32 WW(obs), int32 W1(obs), int32 W2(obs), float32 HW(obs), float32 PW(obs), float32 HWA(obs), float32 PWA(obs)
        groups: 
    >>> 

    Maybe the netcdf lib in your container was not built with curl support, or the linked curl lib doesn't have ssl support?

  2. advapiIT commented on Oct 12, 2022

    @advapiIT
    Author
  3. jswhit commented on Oct 12, 2022

    @jswhit
    Collaborator

    Must be an issue with the linked netcdf-c and/or curl libs - has nothing to do with the python interface itself. Can you try with the conda package?

  4. dopplershift commented on Oct 12, 2022

    @dopplershift
    Member

    @advapilT are you aware that nccopy (comes with the netCDF C library) can do this for you already?

    nccopy -V TA,TD https://thredds.met.no/thredds/dodsC/arcticdata/obsSynop/04320 mydata.nc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions