Unidata / tds

THREDDS Data Server
https://docs.unidata.ucar.edu/tds/5.0/userguide/index.html
BSD 3-Clause "New" or "Revised" License
64 stars 26 forks source link

NETCDF3 format not supported for ANY_POINT feature type #269

Open avarf opened 2 years ago

avarf commented 2 years ago

I am using the pvlib library to get the GFS data but I am getting below error:

requests.exceptions.HTTPError: Error accessing https://thredds.ucar.edu/thredds/ncss/grid/grib/NCEP/GFS/Global_0p5deg/Best?var=v-component_of_wind_isobaric&var=Temperature_surface&var=u-component_of_wind_isobaric&var=Total_cloud_cover_entire_atmosphere_Mixed_intervals_Average&var=High_cloud_cover_high_cloud_Mixed_intervals_Average&var=Low_cloud_cover_low_cloud_Mixed_intervals_Average&var=Medium_cloud_cover_middle_cloud_Mixed_intervals_Average&var=Total_cloud_cover_convective_cloud&var=Downward_Short-Wave_Radiation_Flux_surface_Mixed_intervals_Average&var=Total_cloud_cover_boundary_layer_cloud_Mixed_intervals_Average&var=Wind_speed_gust_surface&time_start=2022-08-11T11%3A29%3A36.967991%2B00%3A00&time_end=2022-08-18T11%3A29%3A36.967991%2B00%3A00&longitude=2.3522&latitude=48.8566&vertCoord=100000&accept=netcdf
Server Error (400: NETCDF3 format not supported for ANY_POINT feature type.)

Based on the issue at https://github.com/pvlib/pvlib-python/issues/1522 this endpoint was working until a few days ago, was there any change in the API? How can I solve this issue?

q33420540 commented 2 years ago

same question as me

haileyajohnson commented 2 years ago

As of version 5.x, the TDS is only able to write CF-compliant datasets, which means it cannot write a subset of multiple feature types to a netcdf file. From the CF site: "the features contained within a collection must always be of the same type; and all the collections in a CF file must be of the same feature type"

I believe the request in question is attempting to subset both a timeseries feature and a timeseries profile feature at once, which the TDS can't do. The available workarounds are a) request the output in CSV or XML format b) split up the subset request by feature type (i.e. variables with a vertical dimension and variables without)

q33420540 commented 2 years ago

As of version 5.x, the TDS is only able to write CF-compliant datasets, which means it cannot write a subset of multiple feature types to a netcdf file. From the CF site: "the features contained within a collection must always be of the same type; and all the collections in a CF file must be of the same feature type"

I believe the request in question is attempting to subset both a timeseries feature and a timeseries profile feature at once, which the TDS can't do. The available workarounds are a) request the output in CSV or XML format b) split up the subset request by feature type (i.e. variables with a vertical dimension and variables without)

I tried requesting the csv file directly via a siphon request, but this causes lins overlap. Could you give me some ideas to get following data together? Bay the way, how can I get the variable list in the server?


error: Line #1099 (got 10 columns instead of 7) Line #1100 (got 10 columns instead of 7) Line #1101 (got 10 columns instead of 7) Line #1102 (got 10 columns instead of 7) Line #1103 (got 10 columns instead of 7)


query.accept('csv') query.variables('Temperature_surface', 'Wind_speed_gust_surface', 'u-component_of_wind_isobaric', 'v-component_of_wind_isobaric', 'Total_cloud_cover_entire_atmosphere_Mixed_intervals_Average', 'Low_cloud_cover_low_cloud_Mixed_intervals_Average', 'Medium_cloud_cover_middle_cloud_Mixed_intervals_Average', 'High_cloud_cover_high_cloud_Mixed_intervals_Average', 'Total_cloud_cover_boundary_layer_cloud_Mixed_intervals_Average' ,
'Total_cloud_cover_convective_cloud', 'Downward_Short-Wave_Radiation_Flux_surface_Mixed_intervals_Average')

haileyajohnson commented 2 years ago

We have an example of using NCSS with siphon here, as well as the NCSS API here.

I'm not sure what to make of the error you're reporting without more context, such as example code and a full stack trace.

dopplershift commented 2 years ago

You can see the dataset.xml document that includes all of the variables by changing the URL from dataset.html to dataset.xml, as in:

https://thredds.ucar.edu/thredds/ncss/grid/grib/NCEP/GFS/Global_0p25deg_ana/GFS_Global_0p25deg_ana_20220815_1800.grib2/dataset.xml

This is also accessible off the NCSS helper in siphon as list(ncss.metadata.variables).

q33420540 commented 2 years ago

Thanks so much for your advice, I will have a try

dopplershift commented 2 years ago

So while I think the original query will always have problems due to a mix of surface and profile variables, changing to request 'v-component_of_wind_height_above_ground', 'Liquid_Volumetric_Soil_Moisture_non_Frozen_depth_below_surface_layer', which have dimensions of time=373, height_above_ground2=7, lat=361, lon=720 and time=373, depth_below_surface_layer=4, lat=361, lon=720, respectively, still yields Server Error (400: NETCDF4 format not supported for ANY_POINT feature type.) so I think something is off in the determination of what is an ANY_POINT.

Also, it would be really good to improve the error message to something like: "Data queries that request a mix of timeseries and timeseries_profile types are not supported by netCDF returns. Make sure you don't ask for a combination of single-level and multi-level variables on your netcdf point request."

avarf commented 2 years ago

I am able to use the example in that link but I am getting the same error again. The issue is for some variables ( the server returns the forecast but for anything related to clouds it returns an error. For example query.variables('Temperature_surface', 'Wind_speed_gust_surface') this works fine but query.variables('Low_cloud_cover_low_cloud_Mixed_intervals_Average') returns server error Server Error (400: NETCDF4 format not supported for ANY_POINT feature type.).

I checked and all the cloud variables that I need and they are in the variable list but I am receiving error for them:

ncssvars = list(ncss.variables)
print('Total_cloud_cover_entire_atmosphere_Mixed_intervals_Average' in ncssvars)
print('Low_cloud_cover_low_cloud_Mixed_intervals_Average' in ncssvars)
print('Total_cloud_cover_convective_cloud' in ncssvars)
print('Downward_Short-Wave_Radiation_Flux_surface_Mixed_intervals_Average' in ncssvars)

# Output
True
True
True
True
dopplershift commented 2 years ago

Right, try doing the request for Low_cloud_cover_low_cloud_Mixed_intervals_Average separately. The problem is that the surface fields result in a timeseries return, while the other ends up with a profile timeseries return. These cannot be returned in a single CF-compliant netCDF file.

avarf commented 2 years ago

Yes, if I break the query into many sub-queries that works. It took me a little time to find out which variables can be queried together without raising an error, now my code is like this:

query1.variables('Total_cloud_cover_entire_atmosphere_Mixed_intervals_Average', 'Medium_cloud_cover_middle_cloud_Mixed_intervals_Average', 'High_cloud_cover_high_cloud_Mixed_intervals_Average', 'Total_cloud_cover_boundary_layer_cloud_Mixed_intervals_Average','Low_cloud_cover_low_cloud_Mixed_intervals_Average','Downward_Short-Wave_Radiation_Flux_surface_Mixed_intervals_Average')

query2.variables('Total_cloud_cover_convective_cloud')

query3.variables('Temperature_surface', 'Wind_speed_gust_surface')

query4.variables('u-component_of_wind_isobaric', 'v-component_of_wind_isobaric')