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

Support amda template params #192

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

brenard-irap
Copy link
Collaborator

This PR fixes issue #163

Now if you get data for "amda/jade_l5e180_def" parameters, an exception is raised to indicate that an "additional arguments" is needed.

data = spz.get_data("amda/jade_l5e180_def", "2021-01-01", "2021-01-02")
speasy.core.impex.exceptions.MissingTemplateArgs: Parameter jade_l5e180_def requires additional arguments to be used:
{
  "lookdir": {
    "name": "Look Direction",
    "type": "list",
    "default": "0",
    "items_list": {
      "0": {
        "name": "Look Dir. 0"
      },
      "1": {
        "name": "Look Dir. 1"
      },
      "2": {
        "name": "Look Dir. 2"
      },
      "3": {
        "name": "Look Dir. 3"
      },
      "4": {
        "name": "Look Dir. 4"
      },
      "5": {
        "name": "Look Dir. 5"
      },
      "6": {
        "name": "Look Dir. 6"
      },
      "7": {
        "name": "Look Dir. 7"
      },
      "8": {
        "name": "Look Dir. 8"
      },
      "9": {
        "name": "Look Dir. 9"
      },
      "10": {
        "name": "Look Dir. 10"
      },
      "11": {
        "name": "Look Dir. 11"
      },
      "12": {
        "name": "Look Dir. 12"
      },
      "13": {
        "name": "Look Dir. 13"
      },
      "14": {
        "name": "Look Dir. 14"
      },
      "15": {
        "name": "Look Dir. 15"
      },
      "16": {
        "name": "Look Dir. 16"
      },
      "17": {
        "name": "Look Dir. 17"
      },
      "18": {
        "name": "Look Dir. 18"
      },
      "19": {
        "name": "Look Dir. 19"
      },
      "20": {
        "name": "Look Dir. 20"
      },
      "21": {
        "name": "Look Dir. 21"
      },
      "22": {
        "name": "Look Dir. 22"
      },
      "23": {
        "name": "Look Dir. 23"
      },
      "24": {
        "name": "Look Dir. 24"
      },
      "25": {
        "name": "Look Dir. 25"
      },
      "26": {
        "name": "Look Dir. 26"
      },
      "27": {
        "name": "Look Dir. 27"
      },
      "28": {
        "name": "Look Dir. 28"
      },
      "29": {
        "name": "Look Dir. 29"
      },
      "30": {
        "name": "Look Dir. 30"
      },
      "31": {
        "name": "Look Dir. 31"
      },
      "32": {
        "name": "Look Dir. 32"
      },
      "33": {
        "name": "Look Dir. 33"
      },
      "34": {
        "name": "Look Dir. 34"
      },
      "35": {
        "name": "Look Dir. 35"
      },
      "36": {
        "name": "Look Dir. 36"
      },
      "37": {
        "name": "Look Dir. 37"
      },
      "38": {
        "name": "Look Dir. 38"
      },
      "39": {
        "name": "Look Dir. 39"
      },
      "40": {
        "name": "Look Dir. 40"
      },
      "41": {
        "name": "Look Dir. 41"
      },
      "42": {
        "name": "Look Dir. 42"
      },
      "43": {
        "name": "Look Dir. 43"
      },
      "44": {
        "name": "Look Dir. 44"
      },
      "45": {
        "name": "Look Dir. 45"
      },
      "46": {
        "name": "Look Dir. 46"
      }
    }
  }
}
For example:
===========================================================================
    data = spz.get_data(PRODUCT, START, STOP, additional_arguments={"lookdir": "0"})
===========================================================================

This tells you that the additional ‘lookdir’ argument is required to get the data for this parameter. For exemple:

data_lookdir_0 = spz.amda.get_parameter("jade_l5e180_def", "2021-01-01", "2021-01-02", additional_arguments={"lookdir": "0"})

data_lookdir_1 = spz.amda.get_parameter("jade_l5e180_def", "2021-01-01", "2021-01-02", additional_arguments={"lookdir": "1"})

And the same thing is available for access to VEX/IMA/extraparams data (and for all AMDA templated parameters):

data = spz.get_data(spz.inventories.tree.amda.Parameters.VEX.IMA.vex_ima_extra.vex_h_spec, "2012-01-01", "2012-01-02")
speasy.core.impex.exceptions.MissingTemplateArgs: Parameter vex_h_spec requires additional arguments to be used:
{
  "anode": {
    "name": "Anode",
    "type": "list",
    "default": "0",
    "items_list": {
      "0": {
        "name": "Anode 0"
      },
      "1": {
        "name": "Anode 1"
      },
      "2": {
        "name": "Anode 2"
      },
      "3": {
        "name": "Anode 3"
      },
      "4": {
        "name": "Anode 4"
      },
      "5": {
        "name": "Anode 5"
      },
      "6": {
        "name": "Anode 6"
      },
      "7": {
        "name": "Anode 7"
      },
      "8": {
        "name": "Anode 8"
      },
      "9": {
        "name": "Anode 9"
      },
      "10": {
        "name": "Anode 10"
      },
      "11": {
        "name": "Anode 11"
      },
      "12": {
        "name": "Anode 12"
      },
      "13": {
        "name": "Anode 13"
      },
      "14": {
        "name": "Anode 14"
      },
      "15": {
        "name": "Anode 15"
      }
    }
  }
}
For example:
===========================================================================
    data = spz.get_data(PRODUCT, START, STOP, additional_arguments={"anode": "0"})
===========================================================================

You just need to select the anode you want:

data_anode_0 = spz.get_data(spz.inventories.tree.amda.Parameters.VEX.IMA.vex_ima_extra.vex_h_spec, "2012-01-01", "2012-01-02", additional_arguments={"anode": "0"})
data_anode_1 = spz.get_data(spz.inventories.tree.amda.Parameters.VEX.IMA.vex_ima_extra.vex_h_spec, "2012-01-01", "2012-01-02", additional_arguments={"anode": "1"})

Copy link

@jeandet jeandet self-requested a review January 23, 2025 10:13
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

Successfully merging this pull request may close these issues.

2 participants