Skip to content

Instantly share code, notes, and snippets.

@joefutrelle
Created October 23, 2014 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joefutrelle/e49167d72a961e273e87 to your computer and use it in GitHub Desktop.
Save joefutrelle/e49167d72a961e273e87 to your computer and use it in GitHub Desktop.
IFCB product reorg
<namespace name="ifcb.utils">
<rule name="reorg_products" include="src dest">
<invoke rule="ifcb.files.find_data_dirs"/>
<!-- directory=product root dir, product=product type -->
<any>
<test var="product" eq="blobs">
<path var="src" match="${directory}/[0-9]*/[0-9]*/*_blobs_v2.zip"/>
<match var="src" pattern=".*/((.*_blobs).*)" groups="product_filename pid"/>
<invoke rule="ifcb.pid"/>
</test>
<test var="product" eq="features">
<path var="src" match="${directory}/features[0-9]*_v[0-9]/*_fea_v2.csv"/>
<match var="src" pattern=".*/((.*_fea).*)" groups="product_filename pid"/>
<var name="pid">${pid}tures</var>
<invoke rule="ifcb.pid"/>
</test>
</any>
<log>${pid}</log>
<var name="root">${directory}</var><!-- fixme ugly way to alias -->
<invoke rule="ifcb.files.find_product"/>
<first>
<test var="schema_version" eq="v1">
<var name="dest">${root}${year}/IFCB${instrument}_${year}_${day}/${product_filename}</var>
</test>
<test var="schema_version" eq="v2">
<var name="dest">${root}${year}/D${yearday}/${product_filename}</var>
</test>
</first>
</rule>
</namespace>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment