Uploading a trajectory using the sapre upload model.
User files can be uploaded and used as sapre trajectories
sapre upload read_file_into_array
User files can be uploaded and used as sapre trajectories
sapre upload read_file_into_array
# coding=utf-8
"""
title: Uploading a trajectory using the sapre upload model.
description: User files can be uploaded and used as sapre trajectories
keywords: sapre, upload, read_file_into_array
"""
from nom_client.utils.file_util import read_file_into_array
from nom_client.nom_client import NoMClient
conf = {
"servers": {
"ext_rest_server": {
"type": "rest",
"server_addr": "https://nom.esa.int",
"api_version": "api",
"api_key": ""
}
}
}
nom_client = NoMClient("sapre upload example", client_configuration=conf, default_server_id="ext_rest_server")
nom_client.set_default_server("local_server")
sapre_file = read_file_into_array(file_name='<PATH>/sapre_upload.csv')
sapre_model_upload = nom_client.get_model('sapre_upload')
sapre_model_upload.set_params(trajectoryUpload=sapre_file)
sapre_model_upload_result = nom_client.run_model(sapre_model_upload)
print(sapre_model_upload_result)
"""
The content is the sapre_upload.csv is as follows:
--------------------------------
******************************************************************
* Geocentric trajectory of Rosetta's first Earth flyby.
*
* Taken from:
* http://www.lepp.cornell.edu/~seb/celestia/spacecraft.html#3.4.5
******************************************************************
Title: Rosetta first Earth flyby
Planet: Earth
Coordinates: GEI
Columns: JDCT, X, Y, Z
Format: CSV
******************************************************************
$$BEGIN
2453427.500, -2358221.228, 552722.0993, 98289.65571
2453427.507, -2355913.806, 552192.5571, 98201.38984
2453427.514, -2353606.41, 551663.0371, 98113.13659
2453427.521, -2351299.04, 551133.5394, 98024.89595
2453427.528, -2348991.695, 550604.0639, 97936.6679
2453427.535, -2346684.375, 550074.6106, 97848.45244
$$END
"""