Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding NetCDF resource file to a NetcdfResource #96

Open
c-krew opened this issue Nov 9, 2018 · 1 comment
Open

Adding NetCDF resource file to a NetcdfResource #96

c-krew opened this issue Nov 9, 2018 · 1 comment

Comments

@c-krew
Copy link

c-krew commented Nov 9, 2018

I created a composite resource and I am trying to add a netcdf file to the resource. When I do it all in one step, the function works but when I try to do it by creating a resource (hs.createResource) and then adding (hs.addResourceFile) , there is an error. I am adding the resource using a file path but the function thinks its a file-like object and requires a filename.

Here is the code:

hs = HydroShare(auth=auth)
abstract = 'Flood Extent App NETCDF for grid ' + str(gridid)
title = 'Flood Extent for ' + str(gridid)
rtype = 'NetcdfResource'
fpath = thredds + "floodedgrid" + str(gridid) + ".nc" # path_to_file
resourceid = hs.createResource(rtype, title)
response = hs.addResourceFile(resourceid, fpath, resource_filename="flood.nc")

Here is the error:

File "/Users/student/tethys/src/tethys_apps/tethysapp/flood_extent_app/ajax_controllers.py", line 191, in createnetcdf
response = hs.addResourceFile(resourceid, fpath, resource_filename="flood.nc")
File "/Users/student/tethys/miniconda/envs/tethys/lib/python2.7/site-packages/hs_restclient/init.py", line 859, in addResourceFile
raise HydroShareHTTPException((url, 'POST', r.status_code))
File "/Users/student/tethys/miniconda/envs/tethys/lib/python2.7/site-packages/hs_restclient/exceptions.py", line 66, in init
self.status_msg = args[3]

@c-krew c-krew changed the title Adding NetCDF resource file to a composite resource Adding NetCDF resource file to a NetcdfResource Nov 9, 2018
@pkdash
Copy link
Member

pkdash commented Nov 9, 2018

I am guessing the netcdf file may be failing validation. Can you try uploading the same file to a netcdf resource using the website and see if the file gets added to the resource?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants