{"id":358,"date":"2013-11-03T06:22:00","date_gmt":"2013-11-03T06:22:00","guid":{"rendered":"http:\/\/ahay.org\/blog\/?p=358"},"modified":"2015-08-30T17:50:22","modified_gmt":"2015-08-30T17:50:22","slug":"program-of-the-month-sfremap1","status":"publish","type":"post","link":"https:\/\/ahay.org\/blog\/2013\/11\/03\/program-of-the-month-sfremap1\/","title":{"rendered":"Program of the month: sfremap1"},"content":{"rendered":"<p><a href=\"\/RSF\/sfremap1.html\">sfremap1<\/a> interpolates the input data to a different grid along the first axis. Here is an elementary example: making some data and interpolating it to a denser grid: <\/p>\n<div class=\"code-box\"><div class=\"code-title\"><i class=\"fa fa-code\"><\/i> <div class=\"pull-right\"><a href=\"#\" class=\"btn btn-default btn-xs toggle-code\" data-toggle=\"tooltip\" title=\"Toggle code\"><i class=\"fa fa-toggle-up\"><\/i><\/a><\/div><\/div><pre ><code>bash$ sfmath n1=5 o1=0 d1=1 output=x1 | sfdisfil \n0: 0 1 2 3 4 \nbash$ sfmath n1=5 o1=0 d1=1 output=x1 | sfremap1 n1=10 d1=0.5 | sfdisfil \n0: 0 0.5 1 1.5 2 \n5: 2.5 3 3.5 4 4.5\n<\/code><\/pre><\/div>\n<p><strong>sfremap1<\/strong> uses ENO (essentially non-oscillatory) interpolation to prevent oscillations when interpolating discontinuous data:  <\/p>\n<div class=\"code-box\"><div class=\"code-title\"><i class=\"fa fa-code\"><\/i> <div class=\"pull-right\"><a href=\"#\" class=\"btn btn-default btn-xs toggle-code\" data-toggle=\"tooltip\" title=\"Toggle code\"><i class=\"fa fa-toggle-up\"><\/i><\/a><\/div><\/div><pre ><code>bash$ sergey$ sfspike n1=10 o1=0 d1=1 k1=6 | sfcausint | sfdisfil \n0: 0 0 0 0 0 \n5: 1 1 1 1 1 \nbash$ sfspike n1=10 o1=0 d1=1 k1=6 | sfcausint | sfremap1 n1=20 d1=0.5 | sfdisfil \n0: 0 0 0 0 0 \n5: 0 0 0 0 0.5 \n10: 1 1 1 1 1 \n15: 1 1 1 1 1\n<\/code><\/pre><\/div>\n<p>The ENO algorithm is described by Harten et al. (1987) and Shu and Osher (1988): <\/p>\n<p>A. Harten, B. Engquist, S. Osher, and S. R. Chakravarthy, 1987, Uniformly high order accurate essentially non-oscillatory schemes, III: <em>Journal of Computational Physics,<\/em> 71(2), 231-303. <\/p>\n<p>C. W. Shu and S. Osher, 1988, Efficient implementation of essentially non-oscillatory shock-capturing schemes: <em>Journal of Computational Physics<\/em>, 77(2), 439-471. <\/p>\n<p>The interpolation order is controlled by the <strong>order=<\/strong> parameter, <strong>order=2<\/strong> corresponds to linear interpolation, the default is <strong>order=3<\/strong>. The output grid can be specified either by n1=, o1=, d1= parameters or by providing an example file with the desired grid in <strong>pattern=<\/strong> parameter. Here is an example:  <\/p>\n<div class=\"code-box\"><div class=\"code-title\"><i class=\"fa fa-code\"><\/i> <div class=\"pull-right\"><a href=\"#\" class=\"btn btn-default btn-xs toggle-code\" data-toggle=\"tooltip\" title=\"Toggle code\"><i class=\"fa fa-toggle-up\"><\/i><\/a><\/div><\/div><pre ><code>bash$ sfmath n1=5 o1=0 d1=1 output=x1 &gt; data.rsf\nbash$ sfspike n1=10 d1=0.5 &gt; other.rsf\nbash$ &lt; data.rsf sfremap1 pattern=other.rsf | sfdisfil\n   0:             0          0.5            1          1.5            2\n   5:           2.5            3          3.5            4          4.5\n<\/code><\/pre><\/div>\n<p>For an alternative method (cubic spline interpolation), see <a href=\"\/RSF\/sfspline.html\">sfspline<\/a>. <\/p>\n<h3 id=\"10previousprogramsofthemonth\">10 previous programs of the month:<\/h3>\n<ul>\n<li><a href=\"\/blog\/2013\/10\/03\/program-of-the-month-sfunif2\/\">sfunif2<\/a><\/li>\n<li><a href=\"\/blog\/2013\/09\/14\/program-of-the-month-sfpatch\/\">sfpatch<\/a><\/li>\n<li><a href=\"\/blog\/2013\/08\/02\/program-of-the-month-sfai2refl\/\">sfai2refl<\/a><\/li>\n<li><a href=\"\/blog\/2013\/07\/01\/program-of-the-month-sftime2depth\/\">sftime2depth<\/a><\/li>\n<li><a href=\"\/blog\/2013\/06\/12\/program-of-the-month-sfwiggle\/\">sfwiggle<\/a><\/li>\n<li><a href=\"\/blog\/2013\/05\/04\/program-of-the-month-sfvscan\/\">sfvscan<\/a><\/li>\n<li><a href=\"\/blog\/2013\/04\/08\/program-of-the-month-sfnmo\/\">sfnmo<\/a><\/li>\n<li><a href=\"\/blog\/2013\/03\/10\/program-of-the-month-sfpow\/\">sfpow<\/a><\/li>\n<li><a href=\"\/blog\/2013\/02\/09\/program-of-the-month-sfpwd\/\">sfpwd<\/a><\/li>\n<li><a href=\"\/blog\/2013\/01\/08\/program-of-the-month-sfricker1\/\">sfricker1<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>sfremap1 interpolates the input data to a different grid along the first axis. Here is an elementary example: making some data and interpolating it to a denser grid: bash$ sfmath n1=5 o1=0 d1=1 output=x1 | sfdisfil 0: 0 1 2 3 4 bash$ sfmath n1=5 o1=0 d1=1 output=x1 | sfremap1 n1=10 d1=0.5 | sfdisfil 0: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","activitypub_content_warning":"","activitypub_content_visibility":"local","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-358","post","type-post","status-publish","format-standard","hentry","category-programs"],"_links":{"self":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts\/358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/comments?post=358"}],"version-history":[{"count":3,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts\/358\/revisions"}],"predecessor-version":[{"id":15434,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts\/358\/revisions\/15434"}],"wp:attachment":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/media?parent=358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/categories?post=358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/tags?post=358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}