Giter Club home page Giter Club logo

Comments (3)

stscieisenhamer avatar stscieisenhamer commented on July 18, 2024

Just as an example of use with the association product names:

with open('the_association', 'r') as asn_fh:
    asn = Association.load(asn_fh)
my_result_model = code_returning_some_jwst_datamodels_result_model(asn)
output_dir = '/the/output/directory/path/from--output_dir'
product_type = 'i2d' # Assuming CALIMAGE3
product_name = asn['products'][0]['name']
full_output_path = output_dir + '/' + product_name.format(product_type=product_type)
my_result_model.save(full_output_path)

from jwst.

hbushouse avatar hbushouse commented on July 18, 2024

Regarding line 4 in the above example, if the user specifies the --output_dir param to strun, it will show up as an attribute of the pipeline or step that's being run, as self.output_dir. Hence pipeline modules can check for "self.output_dir is not None" and if so, then be sure to prepend the value of self.output_dir to the output file name.

from jwst.

hbushouse avatar hbushouse commented on July 18, 2024

Oh, and instead of using the direct approach of appending the path and filename just by using the "+" operator, it might be safer and more OS-benign to use the os.path.join function to do that, i.e. full_output_path = os.path.join(output_dir, product_name).

from jwst.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.