[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[python #DVT-547480]: help on NCSS


If you want to request more than one time, why not do this instead:

    from datetime import datetime, timedelta
    from siphon.catalog import TDSCatalog

    best_gfs = 
    ncss = best_gfs.datasets[0].subset()
    query = ncss.query()
    now = datetime.utcnow()
    query.lonlat_box(north=43, south=35, east=-100, west=-111)
    query.time_range(now, now + timedelta(days=7))

This allows the server to figure out what data it has that's within your 
requested time range. It's more efficient and avoids you having to loop to find 
available times. (Again, if you're using the URL to the Best dataset 
collection, you do not have access to individual files, only an aggregation 
across all the files on the dataserver.  ) Making the time range request will 
also be more efficient than looping and making multiple requests.


> Hi Ryan,
> I got almost the same error info as yours. What I want is
> Do a loop of time
> Do Nt = 1, N
> 1. if the file exists, read the data
> 2. if the file does not exist, then jump to next time
> Enddo
> The problem I encountered is as yours at step 2, it's broken, and the do loop 
> stops.
> I wonder if there is any way to check if the file exist first, if not, go to 
> the next time. THX.
> ?On 5/16/19, 5:13 PM, "Unidata Python Support" <address@hidden> wrote:
> Hi,
> Siphon is not looking at individual files, but rather the THREDDS Data Server 
> is a providing access to a virtual dataset that combines the output from 
> multiple files.
> If you're having trouble accessing certain times, the data may not be 
> available, you may need to adjust the call to `datetime.utcnow()`. If I try 
> to request data beyond the time available in the dataset, I get:
> HTTPError: Error accessing 
> http://thredds.ucar.edu/thredds/ncss/grib/NCEP/GFS/Global_0p25deg/Best?var=Temperature_surface&time=2019-06-03T15%3A09%3A58.848943&west=-111&east=-100&south=35&north=43&accept=netcdf4
> Server Error (400: Requested time 2019-06-03T15:09:58.848Z does not intersect 
> actual time range 2019-05-13T00:00:00Z - 2019-06-01T12:00:00Z)
> This took a lot of work for me to hit however. Can you send me the actual 
> error you receive so we can identify whether this is actually a problem with 
> the server?

Ticket Details
Ticket ID: DVT-547480
Department: Support Python
Priority: Low
Status: Closed
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.