Impact 2024: The Industrial Data and AI Conference for and by Users | Nominate Speakers Now for a Ch...
@Everton Colling For the follow up of the previous questions and as a new user I have two questions now;Could we use the Cognite C# Sdk as a common Rest Api Sdk in general to have RestApi client (similar to what RestSharp does for exampl) or is the Cognite Sdk is designed to access and retreive data from Cognite/CDF? What is the difference between Cognite C# Sdk and Cognite Python Sdk? Does both have more or less functionality built-in? When using the Python sdk, once the token is authenticated to access CDF, the message is you are connecting to “Cognite-Postman” but there is not such message in the C# sdk. Is this because with Python you could use Postman for data analytics? Moreover most of the data processing that Postman does also exists in CDF like aggregation, averaging, etc. Are there specific functionalities that Postman does have and CDF doesn’t? Best regads.
Hi,Thanks. That was right, there was no datapoints in the time interval selected.But now the issue after selecting a new time interval is that, when I selected Granularity of “5m” and then “10s”, the timestamp that I get data in always 10 minutes. Why can’t I get data with the same granularity that I want? I have selected an specific externalID for this. Best regards.
Hmmm … Interesting … The code throws an exception with Granularity of 2h, 30m, 1m. When I changed back to Granularity = 1h that used to work before, it throws the same exception as well!!It returns null for dps where dps is;var dps = ts.AggregateDatapoints.Datapoints.Select( dp => new { DateTimeOffset.FromUnixTimeMilliseconds(dp.Timestamp).DateTime, dp.Average });And says;System.NullReferenceException: 'Object reference not set to an instance of an object.'Com.Cognite.V1.Timeseries.Proto.DataPointListItem.AggregateDatapoints.get returned null. Is this because Cognite does not receive this data from the source when I am running the code? Because this worked for 1h granularity before with no problem. Best regards.
Ok, Thanks for your reply.One more question here: to set how often we want to fetch data for us, should we configure the Granularity parameter or ... ? For example, if I want the data for every 1 sec or 10 sec or 1 minute. I tried to put Granularity to be “0.5h” but it crashed. Could you please advise? Best regards.
Hi @Everton Colling Thanks for your reply.My ultimate goal is to convert the data that I pull out from cognite interface into a csv file (in which each of the data type with its ExternalId in one column of the csv and DateTime in the first column), so I would rather have the output result that looks like this now;{ DateTime = 3/23/2023 21:00:00, Average = 13.713887271148339 }{ DateTime = 3/23/2023 22:00:00, Average = 13.662878633528655 }…into the format that I won’t see the words “DateTime = “ and “Average = ” in each row of data. So I mean something similar to the following if possible?DateTime Average3/23/2023 21:00:00 13.7138872711483393/23/2023 22:00:00 13.662878633528655...One other question I have is that in the console.writeline() of the code, there is no string “DateTime = “ or “Average = “, so I wonder how these words was printed out to the console? Best regards.
Hi @Anita Hæhre : There were some specifics regarding our own company interface with Cognite, so I continued the discussion with @Everton Colling in the private session.
Thanks for your prompt reply @Everton Colling. One more question: in the code above where you have defined the CogniteSdk client as “var”, why this client has not been initialized with an instance of CogniteSdk client first (pseudo-code example: Client client = new Client())? I am asking this because I want to access to the client to use that in all methods but if I define it as local var, it will not be accessible in the bottom part of the code above where the client is used to fetch time-series data (which needs a method to call until fetch all the data we need but the instantiation method need to call once. Am I missing something here?
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.