Authorization issue with NetCDF Java

I am trying to get data from a password restricted server with netcdf-java. I have set up an RC based authentication as described in the unidata docs. I have the env variable DAPRCFILE pointing to /some/daprc/location/.daprc, in which I have HTTP.NETRC=/some/other/location/.netrc, of which the content is

machine mmmmmm 
login xxxxxx 
password yyyyyy

However, whenever I try to get data with NetcdfDatasets.openFile(...) I am getting an Authorization failure response. I have tried with nccopy/ncdump which indeed does work. So either netcdf-java does not pick up on the rc file config, or there are some nuances that I may have missed. I’ve tried setting up an HTTPSession with a custom HTTPCredentialsProvider, but couldn’t get it working. I’ve also tried url based authentication, but could not get it working with ncdump/nccopy either.

How do I get authentication working with netcdf-java?

Leave a Comment