MERRA2: Cannot open cookies file 'C:/.urs_cookies': Invalid argument

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
sarahleuthold
Posts: 4
Joined: Fri May 12, 2023 6:21 am America/New_York
Answers: 0

MERRA2: Cannot open cookies file 'C:/.urs_cookies': Invalid argument

by sarahleuthold » Fri May 12, 2023 6:40 am America/New_York

Hi,
I have tried downloading a selection of the MERRA DAS 2d constants V5.2.0 (MAC0NXASM) data. I have installed all the prerequisites as suggested here: https://disc.gsfc.nasa.gov/information/howto?title=How%20to%20Generate%20Earthdata%20Prerequisite%20Files

I have followed the prodecude propsed here: https://disc.gsfc.nasa.gov/information/howto?title=How%20to%20Access%20GES%20DISC%20Data%20Using%20wget%20and%20curl

I have tried both wget and curl but it does not work.

For curl I enter this code in the command prompt:
curl -n -c ~/.urs_cookies -b ~/.urs_cookies -LJO --url https://goldsmr2.gesdisc.eosdis.nasa.gov/opendap/MERRA_MONTHLY/MAC0NXASM.5.2.0/1979/MERRA300.prod.assim.const_2d_asm_Nx.00000000.hdf.nc4?PHIS[0:0][150:200][405:488],SGH[0:0][150:200][405:488],FRLAKE[0:0][150:200][405:488],FRLAND[0:0][150:200][405:488],FRLANDICE[0:0][150:200][405:488],FROCEAN[0:0][150:200][405:488],XDim_EOS[405:488],YDim_EOS[150:200],Time[0:0],TIME,YDim[150:200],XDim[405:488]

I get this error message: "curl: (3) bad range in URL position 143: https://goldsmr2.gesdisc.eosdis.nasa.gov/opendap/MERRA_MONTHLY/MAC0NXASM.5.2.0/1979/MERRA300.prod.assim.const_2d_asm_Nx.00000000.hdf.nc4?PHIS[0:0][150:200][405:488],SGH[0:0][150:200][405:488],FRLAKE[0:0][150:200][405:488],FRLAND[0:0][150:200][405:488],FRLANDICE[0:0][150:200][405:488],FROCEAN[0:0][150:200][405:488],XDim_EOS[405:488],YDim_EOS[150:200],Time[0:0],TIME,YDim[150:200],XDim[405:488]"



And for wget it doesnt let me enter my password (as in I cannot physically type it, the keyboard doesnt work when it asks for my password).

I am very much stuck. I have tried 1,5 days to fix it but without success.

I'd be happy for some help!

Thanks
Best
Sarah

Tags:

GES DISC - mgreene
User Services
User Services
Posts: 186
Joined: Wed Sep 25, 2019 9:35 am America/New_York
Answers: 2
Been thanked: 1 time

Re: MERRA2: Cannot open cookies file 'C:/.urs_cookies': Invalid argument

by GES DISC - mgreene » Fri May 12, 2023 8:35 am America/New_York

Dear Sarah,
May we suggest using the following command:

wget --user=<USER NAME> --password=<PASSWORD> --content-disposition
'https://goldsmr2.gesdisc.eosdis.nasa.gov/opendap/MERRA_MONTHLY/MAC0NXASM.5.2.0/1979/MERRA300.prod.assim.const_2d_asm_Nx.00000000.hdf.nc4?PHIS[0:0][150:200][405:488],SGH[0:0][150:200][405:488],FRLAKE[0:0][150:200][405:488],FRLAND[0:0][150:200][405:488],FRLANDICE[0:0][150:200][405:488],FROCEAN[0:0][150:200][405:488],XDim_EOS[405:488],YDim_EOS[150:200],Time[0:0],TIME,YDim[150:200],XDim[405:488

Hope this helps.

GES DISC - mgreene
User Services
User Services
Posts: 186
Joined: Wed Sep 25, 2019 9:35 am America/New_York
Answers: 2
Been thanked: 1 time

Re: MERRA2: Cannot open cookies file 'C:/.urs_cookies': Invalid argument

by GES DISC - mgreene » Fri May 12, 2023 10:16 am America/New_York

Correction to my last post, here is the complete command.

wget --user=<USER NAME> --password=<PASSWORD> --content-disposition 'https://goldsmr2.gesdisc.eosdis.nasa.gov/opendap/MERRA_MONTHLY/MAC0NXASM.5.2.0/1979/MERRA300.prod.assim.const_2d_asm_Nx.00000000.hdf.nc4?PHIS[0:0][150:200][405:488],SGH[0:0][150:200][405:488],FRLAKE[0:0][150:200][405:488],FRLAND[0:0][150:200][405:488],FRLANDICE[0:0][150:200][405:488],FROCEAN[0:0][150:200][405:488],XDim_EOS[405:488],YDim_EOS[150:200],Time[0:0],TIME,YDim[150:200],XDim[405:488]'

sarahleuthold
Posts: 4
Joined: Fri May 12, 2023 6:21 am America/New_York
Answers: 0

Re: MERRA2: Cannot open cookies file 'C:/.urs_cookies': Invalid argument

by sarahleuthold » Fri May 12, 2023 11:22 am America/New_York

Hi,

I run this code now and I get an error message (see below):


C:\Users\sarah>wget --load-cookies C:\.urs_cookies --save-cookies C:\.urs_cookies --keep-session-cookies --user=sarahleuthold --ask-password --content-disposition -i url.txt
Password for user 'sarahleuthold':
url.txt: No such file or directory
No URLs found in url.txt.

C:\Users\sarah>wget --load-cookies C:\.urs_cookies --save-cookies C:\.urs_cookies --keep-session-cookies --user=sarahleuthold --ask-password -i url.txt
Password for user 'sarahleuthold':
url.txt: No such file or directory
No URLs found in url.txt.

I am stuck. Help would be highly appreciated. :)

Best
Sarah

GES DISC - mgreene
User Services
User Services
Posts: 186
Joined: Wed Sep 25, 2019 9:35 am America/New_York
Answers: 2
Been thanked: 1 time

Re: MERRA2: Cannot open cookies file 'C:/.urs_cookies': Invalid argument

by GES DISC - mgreene » Fri May 12, 2023 1:51 pm America/New_York

Hi,
that url.txt is the file that contains URLs that the user needs to be downloaded.

sarahleuthold
Posts: 4
Joined: Fri May 12, 2023 6:21 am America/New_York
Answers: 0

Re: MERRA2: Cannot open cookies file 'C:/.urs_cookies': Invalid argument

by sarahleuthold » Mon May 15, 2023 5:42 am America/New_York

Hi,

I have created a .txt file but I get the following errors:

1.
C:\Users\sarah>wget --load-cookies C:\.urs_cookies --save-cookies C:\.urs_cookies --keep-session-cookies --user=sarahleuthold --ask-password --content-disposition -i url1.txt
Password for user 'sarahleuthold':
url1.txt: No such file or directory
No URLs found in url1.txt.


I assume that it cannot find the .txt file which is in my working directory (where the .dodsrc file is located). I therefore have put the .txt file into my Downloads-folder and tried again, see below:

2.
C:\Users\sarah>wget --load-cookies C:\.urs_cookies --save-cookies C:\.urs_cookies --keep-session-cookies --user=sarahleuthold --ask-password --content-disposition -i Downloads\url1.txt
Password for user 'sarahleuthold':
Cannot open cookies file 'C:/.urs_cookies': No such file or directory
--2023-05-15 11:39:38-- https://goldsmr4.gesdisc.eosdis.nasa.gov/data/MERRA2/M2SDNXSLV.5.12.4/doc/MERRA2.README.pdf
Resolving goldsmr4.gesdisc.eosdis.nasa.gov (goldsmr4.gesdisc.eosdis.nasa.gov)... 198.118.197.95
Connecting to goldsmr4.gesdisc.eosdis.nasa.gov (goldsmr4.gesdisc.eosdis.nasa.gov)|198.118.197.95|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1064850 (1,0M) [application/pdf]
Saving to: 'MERRA2.README.pdf.7'

MERRA2.README.pdf.7 100%[=================================================>] 1,01M 1,36MB/s in 0,7s

2023-05-15 11:39:39 (1,36 MB/s) - 'MERRA2.README.pdf.7' saved [1064850/1064850]

--2023-05-15 11:39:39-- https://goldsmr4.gesdisc.eosdis.nasa.gov/daac-bin/OTF/HTTP_services.cgi?FILENAME=%2Fdata%2FMERRA2%2FM2SDNXSLV.5.12.4%2F1980%2F01%2FMERRA2_100.statD_2d_slv_Nx.19800101.nc4&LABEL=MERRA2_100.statD_2d_slv_Nx.19800101.SUB.nc&FORMAT=bmM0Lw&SHORTNAME=M2SDNXSLV&BBOX=-15%2C90%2C10%2C145&SERVICE=L34RS_MERRA2&DATASET_VERSION=5.12.4&VARIABLES=T2MMEAN%2CTPRECMAX&VERSION=1.02
Connecting to goldsmr4.gesdisc.eosdis.nasa.gov (goldsmr4.gesdisc.eosdis.nasa.gov)|198.118.197.95|:443... connected.
Unable to establish SSL connection.


OR

...
Connecting to goldsmr4.gesdisc.eosdis.nasa.gov (goldsmr4.gesdisc.eosdis.nasa.gov)|198.118.197.95|:443... connected.
HTTP request sent, awaiting response... 302 Found
The destination name is too long (302), reducing to 241
Location: https://urs.earthdata.nasa.gov/oauth/authorize/?scope=uid&app_type=401&client_id=e2WVk8Pw6weeLUKZYOxvTQ&response_type=code&redirect_uri=https%3A%2F%2Fgoldsmr4.gesdisc.eosdis.nasa.gov%2Fdata-redirect&state=aHR0cHM6Ly9nb2xkc21yNC5nZXNkaXNjLmVvc2Rpcy5uYXNhLmdvdi9kYWFjLWJpbi9PVEYvSFRUUF9zZXJ2aWNlcy5jZ2k%2FRklMRU5BTUU9JTJGZGF0YSUyRk1FUlJBMiUyRk0yU0ROWFNMVi41LjEyLjQlMkYxOTgwJTJGMDElMkZNRVJSQTJfMTAwLnN0YXREXzJkX3Nsdl9OeC4xOTgwMDEwMy5uYzQmTEFCRUw9TUVSUkEyXzEwMC5zdGF0RF8yZF9zbHZfTnguMTk4MDAxMDMuU1VCLm5jJkZPUk1BVD1ibU0wTHcmU0hPUlROQU1FPU0yU0ROWFNMViZCQk9YPS0xNSUyQzkwJTJDMTAlMkMxNDUmU0VSVklDRT1MMzRSU19NRVJSQTImREFUQVNFVF9WRVJTSU9OPTUuMTIuNCZWQVJJQUJMRVM9VDJNTUVBTiUyQ1RQUkVDTUFYJlZFUlNJT049MS4wMg [following]
--2023-05-15 11:40:23-- https://urs.earthdata.nasa.gov/oauth/authorize/?scope=uid&app_type=401&client_id=e2WVk8Pw6weeLUKZYOxvTQ&response_type=code&redirect_uri=https%3A%2F%2Fgoldsmr4.gesdisc.eosdis.nasa.gov%2Fdata-redirect&state=aHR0cHM6Ly9nb2xkc21yNC5nZXNkaXNjLmVvc2Rpcy5uYXNhLmdvdi9kYWFjLWJpbi9PVEYvSFRUUF9zZXJ2aWNlcy5jZ2k%2FRklMRU5BTUU9JTJGZGF0YSUyRk1FUlJBMiUyRk0yU0ROWFNMVi41LjEyLjQlMkYxOTgwJTJGMDElMkZNRVJSQTJfMTAwLnN0YXREXzJkX3Nsdl9OeC4xOTgwMDEwMy5uYzQmTEFCRUw9TUVSUkEyXzEwMC5zdGF0RF8yZF9zbHZfTnguMTk4MDAxMDMuU1VCLm5jJkZPUk1BVD1ibU0wTHcmU0hPUlROQU1FPU0yU0ROWFNMViZCQk9YPS0xNSUyQzkwJTJDMTAlMkMxNDUmU0VSVklDRT1MMzRSU19NRVJSQTImREFUQVNFVF9WRVJTSU9OPTUuMTIuNCZWQVJJQUJMRVM9VDJNTUVBTiUyQ1RQUkVDTUFYJlZFUlNJT049MS4wMg
Connecting to urs.earthdata.nasa.gov (urs.earthdata.nasa.gov)|198.118.243.33|:443... connected.
Unable to establish SSL connection.



Help would be greatly appreciated, thanks!

Best
Sarah

sarahleuthold
Posts: 4
Joined: Fri May 12, 2023 6:21 am America/New_York
Answers: 0

Re: MERRA2: Cannot open cookies file 'C:/.urs_cookies': Invalid argument

by sarahleuthold » Mon May 15, 2023 5:55 am America/New_York

! Important to add !

I have run the Python code in order to install all the prerequisite files such as the .urs_cookies file. Hence they are created and stored in the right location on my computer (automatically).

GES DISC - mgreene
User Services
User Services
Posts: 186
Joined: Wed Sep 25, 2019 9:35 am America/New_York
Answers: 2
Been thanked: 1 time

Re: MERRA2: Cannot open cookies file 'C:/.urs_cookies': Invalid argument

by GES DISC - mgreene » Wed May 31, 2023 3:31 pm America/New_York

'Unable to establish SSL connection' user error likely means that wget needs to be upgraded. Please check the wget version with 'wget -V' command and upgrade it.
Also, .urs_cookies file still cannot be located by wget, so it is not in the correct location.
Please run wget as:

wget --user=sarahleuthold --ask-password --content-disposition -i url1.txt

GES DISC - mgreene
User Services
User Services
Posts: 186
Joined: Wed Sep 25, 2019 9:35 am America/New_York
Answers: 2
Been thanked: 1 time

Re: MERRA2: Cannot open cookies file 'C:/.urs_cookies': Invalid argument

by GES DISC - mgreene » Tue Jun 06, 2023 5:27 pm America/New_York

Following up to see if you were able to download your data of need successfully.
Please let us know if we can be of further assistance.

Post Reply