Changeset 210 for trunk/SRC/Documentation/idldoc_html_output/search.js
- Timestamp:
- 02/08/07 11:21:07 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Documentation/idldoc_html_output/search.js
r203 r210 1 1 a = new Array(); 2 2 3 a[1] = new Array("./Calendar/caldat.html", "caldat.pro", "", " file_comments Return the calendar date and time given julian date This is the inverse of the function JULDAY 3 calendars are available according to the value of key_caltype variable of the common file cm_4cal : greg 360d noleap categories Calendar param JULIAN in required contains the Julian Day Number which begins at noon of the specified calendar date It should be a long integer param MONTH out Number of the desired month 1 January 12 December param DAY out Number of day of the month param YEAR out Number of the desired year param HOUR out Hour of the day param Minute out Minute of the day param Second out Second and fractions of the day keyword NDAYSPM default 30 To use a calendar with fixed number of days per months see also the use of key_caltype variable of the common file cm_4cal uses cm_4cal restrictions Accuracy using IEEE double precision numbers is approximately 1 10000th of a second history Translated from Numerical Recipies in C by William H Press Brian P Flannery Saul A Teukolsky and William T Vetterling Cambridge University Press 1988 second printing DMS July 1992 DMS April 1996 Added HOUR MINUTE and SECOND keyword AB 7 December 1997 Generalized to handle array input Eric Guilyardi June 1999 Added key_work ndayspm for fixed number of days per months AB 3 January 2000 Make seconds output as DOUBLE in array output Sebastien Masson May 2006 add different calendat with key_caltype variable of the common file cm_4cal version Id: caldat pro 163 2006 08 29 12:59:46Z navarro pro caldat julian month day year hour minute second NDAYSPM ndayspm cm_4cal COMPILE_OPT idl2 ON_ERROR 2 Return to caller if errors IF n_elements key_caltype EQ 0 THEN key_caltype greg if keyword_set ndayspm then key_caltype 360d CASE key_caltype OF greg :BEGIN nParam N_PARAMS IF nParam LT 1 THEN MESSAGE Incorrect number of arguments min_julian 1095 max_julian 1827933925 minn MIN julian MAX maxx IF minn LT min_julian OR maxx GT max_julian THEN MESSAGE Value of Julian date is out of allowed range igreg 2299161L Beginning of Gregorian calendar julLong FLOOR julian 0 5d Better be long minJul MIN julLong IF minJul GE igreg THEN BEGIN all are Gregorian jalpha LONG julLong 1867216L 0 25d 36524 25d ja julLong 1L jalpha long 0 25d jalpha ENDIF ELSE BEGIN ja julLong gregChange WHERE julLong ge igreg ngreg IF ngreg GT 0 THEN BEGIN jalpha long julLong gregChange 1867216L 0 25d 36524 25d ja gregChange julLong gregChange 1L jalpha long 0 25d jalpha ENDIF ENDELSE jalpha 1 clear memory jb TEMPORARY ja 1524L jc long 6680d jb 2439870L 122 1d0 365 25d jd long 365d jc 0 25d jc je long jb jd 30 6001d day TEMPORARY jb TEMPORARY jd long 30 6001d je month TEMPORARY je 1L month TEMPORARY month 1L MOD 12L 1L year TEMPORARY jc 4715L year TEMPORARY year month GT 2 year year year LE 0 see if we need to do hours minutes seconds IF nParam GT 4 THEN BEGIN fraction julian 0 5d TEMPORARY julLong hour floor fraction 24d fraction TEMPORARY fraction hour 24d minute floor fraction 1440d second TEMPORARY fraction minute 1440d 86400d ENDIF if julian is an array reform all output to correct dimensions IF SIZE julian N_DIMENSION GT 0 THEN BEGIN dimensions SIZE julian DIMENSION month REFORM month dimensions day REFORM day dimensions year REFORM year dimensions IF nParam GT 4 THEN BEGIN hour REFORM hour dimensions minute REFORM minute dimensions second REFORM second dimensions ENDIF ENDIF END 360d :BEGIN jul long julian f jul floor jul IF total f NE 0 0 GT 0 THEN BEGIN Get hours minutes seconds hour floor f 24 f f hour 24 d minute floor f 1440 second f minute 1440 d0 86400 0d0 ENDIF ELSE BEGIN hour replicate 0L n_elements julian minute replicate 0L n_elements julian second replicate 0L n_elements julian ENDELSE IF keyword_set ndayspm THEN BEGIN IF ndayspm EQ 1 THEN ndayspm 30 ENDIF ELSE ndayspm 30 ndayspm long ndayspm Z floor julian year z 12 ndayspm 1 month z 12 ndayspm year 1 ndayspm 1 day z 12 ndayspm year 1 ndayspm month 1 WHILE total day LT 1 GT 0 DO BEGIN tochange where day LT 1 month tochange month tochange 1 day tochange day tochange ndayspm ENDWHILE WHILE total month LT 1 GT 0 DO BEGIN tochange where month LT 1 year tochange year tochange 1 month tochange month tochange 12 ENDWHILE year 0 does not exist neg where year LT 0 IF neg 0 NE 1 THEN year neg year neg 1 END noleap :BEGIN jul long julian year jul 365 1 day jul MOD 365L zero where day EQ 0 month 1 day GT 31 day GT 59 day GT 90 day GT 120 day GT 151 day GT 181 day GT 212 day GT 243 day GT 273 day GT 304 day GT 334 month long month day day 31L day GT 31 28L day GT 59 31L day GT 90 30L day GT 120 31L day GT 151 30L day GT 181 31L day GT 212 31L day GT 243 30L day GT 273 31L day GT 304 30L day GT 334 IF zero 0 NE 1 THEN BEGIN year zero year zero 1 month zero 12L day zero 31L ENDIF END ELSE:BEGIN ng report only 3 types of calendar are accepted: greg 360d and noleap return END ENDCASE zero where year ge 600000L cnt IF cnt NE 0 THEN year zero year zero 654321Lreturn END");4 a[2] = new Array("./Calendar/date2jul.html", "date2jul.pro", "", " file_comments gives Julian day equivalent of a date in yyyymmdd format categories Calendar param date in required date in yyyymmdd format keyword GRADS if 1 year 2000 year if 50 year 1900 year returns date in Julian day examples IDL jday juldate 19930124 IDL print date2jul 19931205 EQ julday 12 5 1993 1 IDL print date2jul 931205 grads EQ julday 12 5 1993 1 history Sebastien Masson smasson lodyc jussieu fr June 2005 version Id: date2jul pro 157 2006 08 21 09:01:50Z navarro function date2jul date GRADS grads compile_opt idl2 strictarrsubs year long date 10000 month long abs date 100 MOD 100 day long abs date MOD 100 if keyword_set grads then year year 1900 year GE 50 AND year LE 99 2000 year GE 1 AND year LE 49 return julday month day yearend ");3 a[1] = new Array("./Calendar/caldat.html", "caldat.pro", "", " file_comments Return the calendar date and time given julian date This is the inverse of the function JULDAY 3 calendars are available according to the value of key_caltype variable of the common file cm_4cal : greg 360d noleap categories Calendar param JULIAN in required contains the Julian Day Number which begins at noon of the specified calendar date It should be a long integer param MONTH out Number of the desired month 1 January 12 December param DAY out Number of day of the month param YEAR out Number of the desired year param HOUR out Hour of the day param Minute out Minute of the day param Second out Second and fractions of the day keyword NDAYSPM default 30 To use a calendar with fixed number of days per months see also the use of key_caltype variable of the common file cm_4cal uses cm_4cal restrictions Accuracy using IEEE double precision numbers is approximately 1 10000th of a second history Translated from Numerical Recipies in C by William H Press Brian P Flannery Saul A Teukolsky and William T Vetterling Cambridge University Press 1988 second printing DMS July 1992 DMS April 1996 Added HOUR MINUTE and SECOND keyword AB 7 December 1997 Generalized to handle array input Eric Guilyardi June 1999 Added key_work ndayspm for fixed number of days per months AB 3 January 2000 Make seconds output as DOUBLE in array output Sebastien Masson May 2006 add different calendat with key_caltype variable of the common file cm_4cal version Id: caldat pro 205 2007 01 22 07:55:49Z smasson pro caldat julian month day year hour minute second NDAYSPM ndayspm cm_4cal COMPILE_OPT idl2 ON_ERROR 2 Return to caller if errors IF n_elements key_caltype EQ 0 THEN key_caltype greg if keyword_set ndayspm then key_caltype 360d nParam N_PARAMS IF nParam LT 1 THEN MESSAGE Incorrect number of arguments CASE key_caltype OF greg :BEGIN min_julian 1095 max_julian 1827933925 minn MIN julian MAX maxx IF minn LT min_julian OR maxx GT max_julian THEN MESSAGE Value of Julian date is out of allowed range igreg 2299161L Beginning of Gregorian calendar julLong FLOOR julian 0 5d Better be long minJul MIN julLong IF minJul GE igreg THEN BEGIN all are Gregorian jalpha LONG julLong 1867216L 0 25d 36524 25d ja julLong 1L jalpha long 0 25d jalpha ENDIF ELSE BEGIN ja julLong gregChange WHERE julLong ge igreg ngreg IF ngreg GT 0 THEN BEGIN jalpha long julLong gregChange 1867216L 0 25d 36524 25d ja gregChange julLong gregChange 1L jalpha long 0 25d jalpha ENDIF ENDELSE jalpha 1 clear memory jb TEMPORARY ja 1524L jc long 6680d jb 2439870L 122 1d0 365 25d jd long 365d jc 0 25d jc je long jb jd 30 6001d day TEMPORARY jb TEMPORARY jd long 30 6001d je month TEMPORARY je 1L month TEMPORARY month 1L MOD 12L 1L year TEMPORARY jc 4715L year TEMPORARY year month GT 2 year year year LE 0 END 360d :BEGIN IF keyword_set ndayspm THEN BEGIN IF ndayspm EQ 1 THEN ndayspm 30 ENDIF ELSE ndayspm 30 ndayspm long ndayspm julLong FLOOR julian 0 5d Better be long year julLong 12 ndayspm 1 month julLong 12 ndayspm year 1 ndayspm 1 day julLong 12 ndayspm year 1 ndayspm month 1 WHILE total day LT 1 GT 0 DO BEGIN tochange where day LT 1 month tochange month tochange 1 day tochange day tochange ndayspm ENDWHILE WHILE total month LT 1 GT 0 DO BEGIN tochange where month LT 1 year tochange year tochange 1 month tochange month tochange 12 ENDWHILE year 0 does not exist neg where year LT 0 IF neg 0 NE 1 THEN year neg year neg 1 END noleap :BEGIN julLong FLOOR julian 0 5d Better be long year julLong 365 1 day julLong MOD 365L zero where day EQ 0 month 1 day GT 31 day GT 59 day GT 90 day GT 120 day GT 151 day GT 181 day GT 212 day GT 243 day GT 273 day GT 304 day GT 334 month long month day day 31L day GT 31 28L day GT 59 31L day GT 90 30L day GT 120 31L day GT 151 30L day GT 181 31L day GT 212 31L day GT 243 30L day GT 273 31L day GT 304 30L day GT 334 IF zero 0 NE 1 THEN BEGIN year zero year zero 1 month zero 12L day zero 31L ENDIF END ELSE:BEGIN ng report only 3 types of calendar are accepted: greg 360d and noleap return END ENDCASE zero where year ge 600000L cnt IF cnt NE 0 THEN year zero year zero 654321L see if we need to do hours minutes seconds IF nParam GT 4 THEN BEGIN fraction julian 0 5d TEMPORARY julLong hour floor fraction 24d fraction TEMPORARY fraction hour 24d minute floor fraction 1440d second TEMPORARY fraction minute 1440d 86400d ENDIF if julian is an array reform all output to correct dimensions IF SIZE julian N_DIMENSION GT 0 THEN BEGIN dimensions SIZE julian DIMENSION month REFORM month dimensions overwrite day REFORM day dimensions overwrite year REFORM year dimensions overwrite IF nParam GT 4 THEN BEGIN hour REFORM hour dimensions overwrite minute REFORM minute dimensions overwrite second REFORM second dimensions overwrite ENDIF ENDIF return END"); 4 a[2] = new Array("./Calendar/date2jul.html", "date2jul.pro", "", " file_comments gives Julian day equivalent of a date in yyyymmdd format categories Calendar param date in required date in yyyymmdd format keyword GRADS if 1 year 2000 year if 50 year 1900 year returns date in Julian day examples IDL jday juldate 19930124 IDL print date2jul 19931205 EQ julday 12 5 1993 1 IDL print date2jul 931205 grads EQ julday 12 5 1993 1 history Sebastien Masson smasson lodyc jussieu fr June 2005 version Id: date2jul pro 205 2007 01 22 07:55:49Z smasson function date2jul date GRADS grads compile_opt idl2 strictarrsubs year long date 10000 month long abs date 100 MOD 100 day long abs date MOD 100 if keyword_set grads then year year 1900 year GE 50 AND year LE 99 2000 year GE 1 AND year LE 49 IF array_equal date long date THEN return julday month day year fraction date long date hour floor fraction 24d fraction TEMPORARY fraction hour 24d minute floor fraction 1440d second TEMPORARY fraction minute 1440d 86400d return julday month day year hour minute second end "); 5 5 a[3] = new Array("./Calendar/date2string.html", "date2string.pro", "", " file_comments create a nice and readable format to print a date categories Calendar String param yyyymmdd in required the date in the format yyyymmdd Can be scalar or array keyword _EXTRA used to pass your keywords to other procedures for example keyword FORMAT of string function see example bellow returns a string containing the date in a easy readable format with the same number of elements than yyyymmdd examples IDL print date2string 19900123 Jan 23 1990 IDL print date2string 19900123 format C CMOA JAN 23 1990 history Sebastien Masson smasson lodyc jussieu fr Creation update review June 2005 Sebastien Masson version Id: date2string pro 157 2006 08 21 09:01:50Z navarro FUNCTION date2string yyyymmdd _EXTRA ex compile_opt idl2 strictarrsubs sday strtrim long yyyymmdd MOD 100 1 smonth strtrim long yyyymmdd 100 MOD 100 2 syear strtrim long yyyymmdd 10000 2 res string format C CMoa 31 fix smonth 1 _EXTRA ex sday syear return res end"); 6 6 a[4] = new Array("./Calendar/daysinmonth.html", "daysinmonth.pro", "", " file_comments give the number of days in a specific month categories Calendar param YEAR in optional default from time common variable of cm_4cal To specify the year of the month Used only if the common variable key_caltype greg In that case month and year must have the same number of elements param MONTH returns number of days in a month or 1 in case of error uses cm_4cal updatenew examples IDL ndays daysinmonth 2 2000 history Sebastien Masson smasson lodyc jussieu fr 2 7 98 update review english new commons: June 2005 Sebastien Masson version Id: daysinmonth pro 163 2006 08 29 12:59:46Z navarro function daysinmonth month year include commons compile_opt idl2 strictarrsubs cm_4cal IF NOT keyword_set key_forgetold THEN BEGIN updatenew ENDIF IF n_elements key_caltype EQ 0 THEN key_caltype greg CASE key_caltype OF 360d : if n_elements month GT 1 THEN return replicate 30 n_elements month ELSE return 30 noleap :BEGIN days_in_mth 31 28 31 30 31 30 31 31 30 31 30 31 IF n_elements month EQ 0 THEN caldat time month return days_in_mth month 1 END greg :BEGIN CASE n_params OF 0:caldat time month day year 2:IF n_elements month NE n_elements year THEN return report month and year must have the same number of elements ELSE:return report daysinmonth accept 0 or 2 input parameters ENDCASE days_in_mth 31 28 31 30 31 30 31 31 30 31 30 31 return days_in_mth month 1 leapyr year month EQ 2 END ELSE:return report only 3 types of calendar are accepted: greg 360d and noleap ENDCASE END"); 7 a[5] = new Array("./Calendar/jul2date.html", "jul2date.pro", "", " file_comments gives yyyymmdd date equivalent of a Julian day categories Calendar param jday in required Julian day returns date in yyyymmdd format examples IDL print jul2date julday 12 23 1999 19991223 history Sebastien Masson smasson lodyc jussieu fr June 2005 version Id: jul2date pro 157 2006 08 21 09:01:50Z navarro function jul2date jday compile_opt idl2 strictarrsubs caldat jday month day year res 10000L year 100L month day year GE 0 10000L year 100L month day year LT 0 return long resend");8 a[6] = new Array("./Calendar/julday.html", "julday.pro", "", " file_comments Calculate the Julian Day Number for a given month day and year This is the inverse of the library function CALDAT 3 calendars are available according to the value of key_caltype variable of the common file cm_4cal : greg 360d noleap categories Calendar param MONTH in required Number of the desired month 1 January 12 December Can be scalar or array param DAY in required Number of day of the month Can be scalar or array param YEARin in required Number of the desired year Year parameters must be valid values from the civil calendar Years B C E are represented as negative integers Years in the common era are represented as positive integers In particular note that there is no year 0 in the civil calendar 1 B C E 1 is followed by 1 C E 1 Change: However for climatological year we do accept the year O but we change it for year 654321L the same trick is done in caldat so caldat julday 1 1 0 gives you back Jan 1st of year 0 Can be scalar or array param HOUR in optional default 12 Number of the hour of the day Can be scalar or array param MINUTE in optional default 0 Number of the minute of the hour Can be scalar or array param SECOND in optional default 0 Number of the second of the minute Can be scalar or array restrictions The Result will have the same dimensions as the smallest array or will be a scalar if all arguments are scalars keyword NDAYSPM default 30 To use a calendar with fixed number of days per months see also the use of key_caltype variable of the common file cm_4cal returns the Julian Day Number which begins at noon of the specified calendar date If Hour Minute and Second are not specified then the result will be a long integer otherwise the result is a double precision floating point number uses cm_4cal restrictions Accuracy using IEEE double precision numbers is approximately 1 10000th of a second with higher accuracy for smaller earlier Julian dates history Translated from Numerical Recipies in C by William H Press Brian P Flannery Saul A Teukolsky and William T Vetterling Cambridge University Press 1988 second printing AB September 1988 DMS April 1995 Added time of day Eric Guilyardi June 1999 Added key_work ndayspm for fixed number of days per months CT April 2000 Now accepts vectors or scalars Sebastien Masson Aug 2003 fix bug for negative and large values of month values eg julday 349 1 1970 Sebastien Masson May 2006 add diferent calendat with key_caltype variable of the common file cm_4cal version Id: julday pro 163 2006 08 29 12:59:46Z navarro function julday MONTH DAY YEARin Hour Minute Second NDAYSPM ndayspm cm_4cal COMPILE_OPT idl2 ON_ERROR 2 Return to caller if errors IF n_elements key_caltype EQ 0 THEN key_caltype greg if keyword_set ndayspm then key_caltype 360d YEAR long yearin zero where year EQ 0 cnt IF cnt NE 0 THEN YEAR zero 654321L CASE key_caltype OF greg :BEGIN Gregorian Calender was adopted on Oct 15 1582 skipping from Oct 4 1582 to Oct 15 1582 GREG 2299171L incorrect Julian day for Oct 25 1582 Process the input if all are missing use todays date NP n_params IF np EQ 0 THEN RETURN SYSTIME JULIAN IF np LT 3 THEN MESSAGE Incorrect number of arguments Find the dimensions of the Result: 1 Find all of the input arguments that are arrays ignore scalars 2 Out of the arrays find the smallest number of elements 3 Find the dimensions of the smallest array Step 1: find all array arguments nDims SIZE month N_DIMENSIONS SIZE day N_DIMENSIONS SIZE year N_DIMENSIONS SIZE hour N_DIMENSIONS SIZE minute N_DIMENSIONS SIZE second N_DIMENSIONS arrays WHERE nDims GE 1 nJulian 1L assume everything is a scalar IF arrays 0 GE 0 THEN BEGIN Step 2: find the smallest number of elements nElement N_ELEMENTS month N_ELEMENTS day N_ELEMENTS year N_ELEMENTS hour N_ELEMENTS minute N_ELEMENTS second nJulian MIN nElement arrays whichVar step 3: find dimensions of the smallest array CASE arrays whichVar OF 0: julianDims SIZE month DIMENSIONS 1: julianDims SIZE day DIMENSIONS 2: julianDims SIZE year DIMENSIONS 3: julianDims SIZE hour DIMENSIONS 4: julianDims SIZE minute DIMENSIONS 5: julianDims SIZE second DIMENSIONS ENDCASE ENDIF d_Second 0d defaults d_Minute 0d d_Hour 0d convert all Arguments to appropriate array size type SWITCH np OF use switch so we fall thru all arguments 6: d_Second SIZE second N_DIMENSIONS GT 0 second 0:nJulian 1 : second 5: d_Minute SIZE minute N_DIMENSIONS GT 0 minute 0:nJulian 1 : minute 4: d_Hour SIZE hour N_DIMENSIONS GT 0 hour 0:nJulian 1 : hour 3: BEGIN convert m d y to type LONG L_MONTH SIZE month N_DIMENSIONS GT 0 LONG month 0:nJulian 1 : LONG month L_DAY SIZE day N_DIMENSIONS GT 0 LONG day 0:nJulian 1 : LONG day L_YEAR SIZE year N_DIMENSIONS GT 0 LONG year 0:nJulian 1 : LONG year END ENDSWITCH min_calendar 4716 max_calendar 5000000 minn MIN l_year MAX maxx IF minn LT min_calendar OR maxx GT max_calendar THEN MESSAGE Value of Julian date is out of allowed range change to accept year 0 if MAX L_YEAR eq 0 NE 0 then message There is no year zero in the civil calendar by seb Aug 2003 tochange where L_MONTH LT 0 IF tochange 0 NE 1 THEN BEGIN L_YEAR tochange L_YEAR tochange L_MONTH tochange 12 1 L_MONTH tochange 12 L_MONTH tochange MOD 12 ENDIF tochange where L_MONTH GT 12 IF tochange 0 NE 1 THEN BEGIN L_YEAR tochange L_YEAR tochange L_MONTH tochange 12 L_MONTH tochange L_MONTH tochange MOD 12 ENDIF by seb Aug 2003 end bc L_YEAR LT 0 L_YEAR TEMPORARY L_YEAR TEMPORARY bc inJanFeb L_MONTH LE 2 JY L_YEAR inJanFeb JM L_MONTH 1b 12b TEMPORARY inJanFeb JUL floor 365 25d JY floor 30 6001d TEMPORARY JM L_DAY 1720995L Test whether to change to Gregorian Calendar IF MIN JUL GE GREG THEN BEGIN change all dates JA long 0 01d TEMPORARY JY JUL TEMPORARY JUL 2L JA long 0 25d JA ENDIF ELSE BEGIN gregChange WHERE JUL ge GREG ngreg IF ngreg GT 0 THEN BEGIN JA long 0 01d JY gregChange JUL gregChange JUL gregChange 2L JA long 0 25d JA ENDIF ENDELSE hour minute second IF np GT 3 THEN BEGIN yes compute the fractional Julian date Add a small offset so we get the hours minutes seconds back correctly if we convert the Julian dates back This offset is proportional to the Julian date so small dates a long long time ago will be more accurate eps MACHAR DOUBLE eps eps eps ABS jul eps For Hours divide by 24 then subtract 0 5 in case we have unsigned integers jul TEMPORARY JUL TEMPORARY d_Hour 24d 0 5d TEMPORARY d_Minute 1440d TEMPORARY d_Second 86400d eps ENDIF check to see if we need to reform vector to array of correct dimensions IF N_ELEMENTS julianDims GT 1 THEN JUL REFORM TEMPORARY JUL julianDims RETURN jul END 360d :BEGIN Fixed number of days per month default 30 : IF keyword_set ndayspm THEN BEGIN IF ndayspm EQ 1 THEN ndayspm 30 ENDIF ELSE ndayspm 30 L_MONTH LONG MONTH L_DAY LONG DAY L_YEAR LONG YEAR neg where L_YEAR LT 0 IF neg 0 NE 1 THEN L_YEAR neg L_YEAR neg 1 JUL L_YEAR 1 12 L_MONTH 1 ndayspm L_DAY if n_elements Hour n_elements Minute n_elements Second eq 0 then return JUL if n_elements Hour eq 0 then Hour 0 if n_elements Minute eq 0 then Minute 0 if n_elements Second eq 0 then Second 0 IF Hour Minute Second EQ 0 THEN return JUL ELSE return JUL Hour 24 0d0 Minute 1440 0d0 Second 86400 0d0 END noleap :BEGIN L_MONTH LONG MONTH L_DAY LONG DAY L_YEAR LONG YEAR tochange where L_MONTH LT 0 IF tochange 0 NE 1 THEN BEGIN L_YEAR tochange L_YEAR tochange L_MONTH tochange 12 1 L_MONTH tochange 12 L_MONTH tochange MOD 12 ENDIF tochange where L_MONTH GT 12 IF tochange 0 NE 1 THEN BEGIN L_YEAR tochange L_YEAR tochange L_MONTH tochange 12 L_MONTH tochange L_MONTH tochange MOD 12 ENDIF L_YEAR L_YEAR 1 daysyear long total 0 0 31 28 31 30 31 30 31 31 30 31 30 cumulative return 365 L_YEAR daysyear L_MONTH L_DAYEND ELSE:return report only 3 types of calendar are accepted: greg 360d and noleap ENDCASE END");7 a[5] = new Array("./Calendar/jul2date.html", "jul2date.pro", "", " file_comments gives yyyymmdd date equivalent of a Julian day categories Calendar param jday in required Julian day returns date in yyyymmdd format examples IDL print jul2date julday 12 23 1999 19991223 history Sebastien Masson smasson lodyc jussieu fr June 2005 version Id: jul2date pro 205 2007 01 22 07:55:49Z smasson function jul2date jday compile_opt idl2 strictarrsubs caldat jday month day year hour min sec res 10000L year 100L month day year GE 0 10000L year 100L month day year LT 0 IF total hour NE 12 min NE 0 sec NE 0 EQ 0 THEN return long res ELSE return double res hour 24 0d0 min 1440 0d0 sec 86400 0d0 end"); 8 a[6] = new Array("./Calendar/julday.html", "julday.pro", "", " file_comments Calculate the Julian Day Number for a given month day and year This is the inverse of the library function CALDAT 3 calendars are available according to the value of key_caltype variable of the common file cm_4cal : greg 360d noleap categories Calendar param MONTH in required Number of the desired month 1 January 12 December Can be scalar or array param DAY in required Number of day of the month Can be scalar or array param YEARin in required Number of the desired year Year parameters must be valid values from the civil calendar Years B C E are represented as negative integers Years in the common era are represented as positive integers In particular note that there is no year 0 in the civil calendar 1 B C E 1 is followed by 1 C E 1 Change: However for climatological year we do accept the year O but we change it for year 654321L the same trick is done in caldat so caldat julday 1 1 0 gives you back Jan 1st of year 0 Can be scalar or array param HOUR in optional default 12 Number of the hour of the day Can be scalar or array param MINUTE in optional default 0 Number of the minute of the hour Can be scalar or array param SECOND in optional default 0 Number of the second of the minute Can be scalar or array restrictions The Result will have the same dimensions as the smallest array or will be a scalar if all arguments are scalars keyword NDAYSPM default 30 To use a calendar with fixed number of days per months see also the use of key_caltype variable of the common file cm_4cal returns the Julian Day Number which begins at noon of the specified calendar date If Hour Minute and Second are not specified then the result will be a long integer otherwise the result is a double precision floating point number uses cm_4cal restrictions Accuracy using IEEE double precision numbers is approximately 1 10000th of a second with higher accuracy for smaller earlier Julian dates history Translated from Numerical Recipies in C by William H Press Brian P Flannery Saul A Teukolsky and William T Vetterling Cambridge University Press 1988 second printing AB September 1988 DMS April 1995 Added time of day Eric Guilyardi June 1999 Added key_work ndayspm for fixed number of days per months CT April 2000 Now accepts vectors or scalars Sebastien Masson Aug 2003 fix bug for negative and large values of month values eg julday 349 1 1970 Sebastien Masson May 2006 add diferent calendat with key_caltype variable of the common file cm_4cal version Id: julday pro 205 2007 01 22 07:55:49Z smasson function julday MONTH DAY YEARin Hour Minute Second NDAYSPM ndayspm cm_4cal COMPILE_OPT idl2 ON_ERROR 2 Return to caller if errors IF n_elements key_caltype EQ 0 THEN key_caltype greg if keyword_set ndayspm then key_caltype 360d YEAR long yearin zero where year EQ 0 cnt IF cnt NE 0 THEN YEAR zero 654321L CASE key_caltype OF greg :BEGIN Gregorian Calender was adopted on Oct 15 1582 skipping from Oct 4 1582 to Oct 15 1582 GREG 2299171L incorrect Julian day for Oct 25 1582 Process the input if all are missing use todays date NP n_params IF np EQ 0 THEN RETURN SYSTIME JULIAN IF np LT 3 THEN MESSAGE Incorrect number of arguments Find the dimensions of the Result: 1 Find all of the input arguments that are arrays ignore scalars 2 Out of the arrays find the smallest number of elements 3 Find the dimensions of the smallest array Step 1: find all array arguments nDims SIZE month N_DIMENSIONS SIZE day N_DIMENSIONS SIZE year N_DIMENSIONS SIZE hour N_DIMENSIONS SIZE minute N_DIMENSIONS SIZE second N_DIMENSIONS arrays WHERE nDims GE 1 nJulian 1L assume everything is a scalar IF arrays 0 GE 0 THEN BEGIN Step 2: find the smallest number of elements nElement N_ELEMENTS month N_ELEMENTS day N_ELEMENTS year N_ELEMENTS hour N_ELEMENTS minute N_ELEMENTS second nJulian MIN nElement arrays whichVar step 3: find dimensions of the smallest array CASE arrays whichVar OF 0: julianDims SIZE month DIMENSIONS 1: julianDims SIZE day DIMENSIONS 2: julianDims SIZE year DIMENSIONS 3: julianDims SIZE hour DIMENSIONS 4: julianDims SIZE minute DIMENSIONS 5: julianDims SIZE second DIMENSIONS ENDCASE ENDIF d_Second 0d defaults d_Minute 0d d_Hour 0d convert all Arguments to appropriate array size type SWITCH np OF use switch so we fall thru all arguments 6: d_Second SIZE second N_DIMENSIONS GT 0 second 0:nJulian 1 : second 5: d_Minute SIZE minute N_DIMENSIONS GT 0 minute 0:nJulian 1 : minute 4: d_Hour SIZE hour N_DIMENSIONS GT 0 hour 0:nJulian 1 : hour 3: BEGIN convert m d y to type LONG L_MONTH SIZE month N_DIMENSIONS GT 0 LONG month 0:nJulian 1 : LONG month L_DAY SIZE day N_DIMENSIONS GT 0 LONG day 0:nJulian 1 : LONG day L_YEAR SIZE year N_DIMENSIONS GT 0 LONG year 0:nJulian 1 : LONG year END ENDSWITCH min_calendar 4716 max_calendar 5000000 minn MIN l_year MAX maxx IF minn LT min_calendar OR maxx GT max_calendar THEN MESSAGE Value of Julian date is out of allowed range change to accept year 0 if MAX L_YEAR eq 0 NE 0 then message There is no year zero in the civil calendar by seb Aug 2003 tochange where L_MONTH LT 0 IF tochange 0 NE 1 THEN BEGIN L_YEAR tochange L_YEAR tochange L_MONTH tochange 12 1 L_MONTH tochange 12 L_MONTH tochange MOD 12 ENDIF tochange where L_MONTH GT 12 IF tochange 0 NE 1 THEN BEGIN L_YEAR tochange L_YEAR tochange L_MONTH tochange 12 L_MONTH tochange L_MONTH tochange MOD 12 ENDIF by seb Aug 2003 end bc L_YEAR LT 0 L_YEAR TEMPORARY L_YEAR TEMPORARY bc inJanFeb L_MONTH LE 2 JY L_YEAR inJanFeb JM L_MONTH 1b 12b TEMPORARY inJanFeb JUL floor 365 25d JY floor 30 6001d TEMPORARY JM L_DAY 1720995L Test whether to change to Gregorian Calendar IF MIN JUL GE GREG THEN BEGIN change all dates JA long 0 01d TEMPORARY JY JUL TEMPORARY JUL 2L JA long 0 25d JA ENDIF ELSE BEGIN gregChange WHERE JUL ge GREG ngreg IF ngreg GT 0 THEN BEGIN JA long 0 01d JY gregChange JUL gregChange JUL gregChange 2L JA long 0 25d JA ENDIF ENDELSE hour minute second IF np GT 3 THEN BEGIN yes compute the fractional Julian date Add a small offset so we get the hours minutes seconds back correctly if we convert the Julian dates back This offset is proportional to the Julian date so small dates a long long time ago will be more accurate eps MACHAR DOUBLE eps eps eps ABS jul eps For Hours divide by 24 then subtract 0 5 in case we have unsigned integers jul TEMPORARY JUL TEMPORARY d_Hour 24d 0 5d TEMPORARY d_Minute 1440d TEMPORARY d_Second 86400d eps ENDIF check to see if we need to reform vector to array of correct dimensions IF N_ELEMENTS julianDims GT 1 THEN JUL REFORM TEMPORARY JUL julianDims RETURN jul END 360d :BEGIN Fixed number of days per month default 30 : IF keyword_set ndayspm THEN BEGIN IF ndayspm EQ 1 THEN ndayspm 30 ENDIF ELSE ndayspm 30 L_MONTH LONG MONTH L_DAY LONG DAY L_YEAR LONG YEAR neg where L_YEAR LT 0 IF neg 0 NE 1 THEN L_YEAR neg L_YEAR neg 1 JUL L_YEAR 1 12 L_MONTH 1 ndayspm L_DAY if n_elements Hour n_elements Minute n_elements Second eq 0 then return JUL if n_elements Hour eq 0 then Hour 12 if n_elements Minute eq 0 then Minute 0 if n_elements Second eq 0 then Second 0 IF total hour NE 12 minute NE 0 second NE 0 EQ 0 THEN return JUL ELSE return JUL Hour 24 0d0 0 5d Minute 1440 0d0 Second 86400 0d0 END noleap :BEGIN L_MONTH LONG MONTH L_DAY LONG DAY L_YEAR LONG YEAR tochange where L_MONTH LT 0 IF tochange 0 NE 1 THEN BEGIN L_YEAR tochange L_YEAR tochange L_MONTH tochange 12 1 L_MONTH tochange 12 L_MONTH tochange MOD 12 ENDIF tochange where L_MONTH GT 12 IF tochange 0 NE 1 THEN BEGIN L_YEAR tochange L_YEAR tochange L_MONTH tochange 12 L_MONTH tochange L_MONTH tochange MOD 12 ENDIF L_YEAR L_YEAR 1 daysyear long total 0 0 31 28 31 30 31 30 31 31 30 31 30 cumulative JUL 365 L_YEAR daysyear L_MONTH L_DAY if n_elements Hour n_elements Minute n_elements Second eq 0 then return JUL if n_elements Hour eq 0 then Hour 12 if n_elements Minute eq 0 then Minute 0 if n_elements Second eq 0 then Second 0 IF total hour NE 12 minute NE 0 second NE 0 EQ 0 THEN return JUL ELSE return JUL Hour 24 0d0 0 5d Minute 1440 0d0 Second 86400 0d0 END ELSE:return report only 3 types of calendar are accepted: greg 360d and noleap ENDCASE END"); 9 9 a[7] = new Array("./Calendar/leapyr.html", "leapyr.pro", "", " file_comments determine whether the input year is a leap year or not Very useful for finding number of days in a year eg NUM_DAYS_IN_YR 365 leapyr year categories Calendar param year in required year to be tested as a leap year Can be scalar or array returns 0 then not a leap year 1 then year is a leap year with the same number of elements than year uses cm_4cal examples IDL result leapyr 2000 history Originally Written by: Trevor Harris Physics Dept University of Adelaide 20 09 88 November 2004: correction for century years S Masson Every year divisible by 4 is a leap year But every year divisible by 100 is NOT a leap year Unless the year is also divisible by 400 then it is still a leap year This means that year 1800 1900 2100 2200 2300 and 2500 are NOT leap years while year 2000 and 2400 are leap years supress the automatic change 89 1989 June 2005 update for new commons Sebastien Masson version Id: leapyr pro 157 2006 08 21 09:01:50Z navarro function leapyr year include commons compile_opt idl2 strictarrsubs cm_4cal yr long year IF n_elements key_caltype EQ 0 THEN key_caltype greg IF key_caltype NE greg THEN BEGIN sd size yr dimensions IF sd 0 EQ 0 THEN return 0b ELSE return bytarr size yr dimensions ENDIF ELSE return yr MOD 4 EQ 0 yr MOD 100 NE 0 yr MOD 400 EQ 0 end"); 10 10 a[8] = new Array("./Calendar/monthname.html", "monthname.pro", "", " file_comments gives the name of a month categories Calendar String param month in required the month number from 1 to 12 Can be scalar or array keyword _EXTRA used to pass your keywords to other procedures for example keyword FORMAT of string function see example bellow returns the month names a string with the same number of elements than month examples IDL name monthname 2 history Sebastien Masson smasson lodyc jussieu fr 1 October 2001 version Id: monthname pro 157 2006 08 21 09:01:50Z navarro FUNCTION monthname month _EXTRA ex compile_opt idl2 strictarrsubs return string format C CMoA0 31 month 1 _EXTRA ex end"); … … 35 35 a[33] = new Array("./Grid/changemsk.html", "changemsk.pro", "", " file_comments add land points on a 2D land sea mask categories Grid param TAB in required a 2D land sea mask with 1 on sea and 0 on land keyword CELLSIZE size in pixel of the square representing one point of the mask returns newmsk the new 2D land sea mask examples IDL a changemsk tmask 0 to add ocean points IDL a 1 changemsk 1 tmask 0 history Sebastien Masson smasson lodyc jussieu fr June 2006 version Id: changemsk pro 163 2006 08 29 12:59:46Z navarro function changemsk tab CELLSIZE cellsize compile_opt idl2 strictarrsubs newmsk 1 taille size tab if taille 0 NE 2 then return newmsk newmsk byte tab if keyword_set cellsize THEN cellsize long cellsize ELSE cellsize long 2 window xsize taille 1 cellsize ysize taille 2 cellsize tvscl congrid newmsk taille 1 cellsize taille 2 cellsize if NOT keyword_set nouseinfos then begin print left button : use it twice to define the diagonal of the rectangle to be set to 0 land print middle button: put 0 land on the clicked point print right button : quit endif cursor x1 y1 device up while mouse button ne 4 do begin case mouse button of 0:return newmsk 1:BEGIN cursor x2 y2 device up x x1 x2 x x sort x x round x cellsize y y1 y2 y y sort y y round y cellsize newmsk x 0 :x 1 y 0 :y 1 0 tvscl replicate 0 x 1 x 0 1 cellsize y 1 y 0 1 cellsize x 0 cellsize y 0 cellsize end 2:BEGIN x1 round x1 cellsize y1 round y1 cellsize newmsk x1 y1 0 tvscl replicate 0 cellsize cellsize x1 cellsize y1 cellsize END ELSE: endcase cursor x1 y1 device up endwhile return newmsk end "); 36 36 a[34] = new Array("./Grid/checkperio.html", "checkperio.pro", "", " file_comments check ORCA2 and ORCA05 periodicity east west and noth fold for files related to the T GRID ONLY categories Grid param file in required type scalar string A string giving the name of the NetCdf file keyword WRITE default 0 type scalar: 0 or 1 Define to 1 to write the good periodicity in the file By default print only mesage of periodicity errors restrictions Works only for grid T points if the WRITE keyword is activated we need the writing access on the file examples IDL checkperio Users smasson OPA modipsl bin runoff_1m_nomask nc checkperio Users smasson OPA modipsl bin runoff_1m_nomask nc nav_lon bad y periodicity 1 nav_lon bad y periodicity 2 nav_lon bad x periodicity 1 nav_lon bad x periodicity 2 nav_lat bad y periodicity 1 nav_lat bad y periodicity 2 nav_lat bad x periodicity 1 nav_lat bad x periodicity 2 socoefr bad y periodicity 1 socoefr bad x periodicity 1 socoefr bad x periodicity 2 sorunoff bad x periodicity 1 sorunoff bad x periodicity 2 IDL checkperio Users smasson OPA modipsl bin runoff_1m_nomask nc WRITE IDL checkperio Users smasson OPA modipsl bin runoff_1m_nomask nc history October 2006: Sebastien Masson smasson locean ipsl upmc fr version Id: checkperio pro 197 2006 10 26 10:45:17Z smasson PRO checkperio file WRITE write IF file_test file EQ 0 THEN BEGIN print file file not found RETURN ENDIF cdfid ncdf_open file WRITE write finq ncdf_inquire cdfid dimsz lonarr finq ndims FOR did 0 finq ndims 1 DO BEGIN ncdf_diminq cdfid did name size dimsz did size ENDFOR FOR vid 0 finq nvars 1 DO BEGIN vinq ncdf_varinq cdfid vid IF vinq ndims GE 2 THEN BEGIN vdimsz dimsz vinq dim jpi vdimsz 0 jpj vdimsz 1 CASE vinq ndims OF 2D VAR 2:BEGIN y periodicity 1 CASE 1 OF array_equal 182 149 vdimsz 0:1 :BEGIN ORCA2 ncdf_varget cdfid vid part1 count jpi 2 1 offset 1 jpj 1 ncdf_varget cdfid vid part2 count jpi 2 1 offset 1 jpj 3 part2 reverse shift part2 1 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad y periodicity 1 IF keyword_set write THEN ncdf_varput cdfid vid part2 count jpi 2 1 offset 1 jpj 1 ENDIF END array_equal 722 511 vdimsz 0:1 :BEGIN ORCA05 ncdf_varget cdfid vid part1 count jpi 2 1 offset 1 jpj 1 ncdf_varget cdfid vid part2 count jpi 2 1 offset 1 jpj 2 part2 reverse part2 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad y periodicity 1 IF keyword_set write THEN ncdf_varput cdfid vid part2 count jpi 2 1 offset 1 jpj 1 ENDIF END ELSE:print vinq name nothing to check ENDCASE y periodicity 2 CASE 1 OF array_equal 182 149 vdimsz 0:1 :BEGIN ORCA2 ncdf_varget cdfid vid part1 count jpi 1 2 2 1 1 offset jpi 1 2 2 jpj 2 ncdf_varget cdfid vid part2 count jpi 1 2 2 1 1 offset 2 jpj 2 part2 reverse part2 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad y periodicity 2 IF keyword_set write THEN ncdf_varput cdfid vid part2 count jpi 1 2 2 1 1 offset jpi 1 2 2 jpj 2 ENDIF END array_equal 722 511 vdimsz 0:1 :BEGIN ORCA05 END ELSE:print vinq name nothing to check ENDCASE x periodicity 1 ncdf_varget cdfid vid part1 count 1 jpj offset 0 0 ncdf_varget cdfid vid part2 count 1 jpj offset jpi 2 0 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad x periodicity 1 IF keyword_set write THEN ncdf_varput cdfid vid part2 count 1 jpj offset 0 0 ENDIF x periodicity 2 ncdf_varget cdfid vid part1 count 1 jpj offset jpi 1 0 ncdf_varget cdfid vid part2 count 1 jpj offset 1 0 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad x periodicity 2 IF keyword_set write THEN ncdf_varput cdfid vid part2 count 1 jpj offset jpi 1 0 ENDIF END 3D VAR 3:BEGIN jpk vdimsz 2 y periodicity 1 CASE 1 OF array_equal 182 149 vdimsz 0:1 :BEGIN ORCA2 ncdf_varget cdfid vid part1 count jpi 2 1 jpk offset 1 jpj 1 0 ncdf_varget cdfid vid part2 count jpi 2 1 jpk offset 1 jpj 3 0 IF jpk EQ 1 THEN part2 reform part2 jpi 2 1 jpk over part2 reverse shift part2 1 0 0 1 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad y periodicity 1 IF keyword_set write THEN ncdf_varput cdfid vid part2 count jpi 2 1 jpk offset 1 jpj 1 0 ENDIF END array_equal 722 511 vdimsz 0:1 :BEGIN ORCA05 ncdf_varget cdfid vid part1 count jpi 2 1 jpk offset 1 jpj 1 0 ncdf_varget cdfid vid part2 count jpi 2 1 jpk offset 1 jpj 2 0 IF jpk EQ 1 THEN part2 reform part2 jpi 2 1 jpk over part2 reverse part2 1 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad y periodicity 1 IF keyword_set write THEN ncdf_varput cdfid vid part2 count jpi 2 1 jpk offset 1 jpj 1 0 ENDIF END ELSE:print vinq name nothing to check ENDCASE y periodicity 2 CASE 1 OF array_equal 182 149 vdimsz 0:1 :BEGIN ORCA2 ncdf_varget cdfid vid part1 count jpi 1 2 2 1 1 jpk offset jpi 1 2 2 jpj 2 0 ncdf_varget cdfid vid part2 count jpi 1 2 2 1 1 jpk offset 2 jpj 2 0 part2 reverse part2 1 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad y periodicity 2 IF keyword_set write THEN ncdf_varput cdfid vid part2 count jpi 1 2 2 1 1 jpk offset jpi 1 2 2 jpj 2 0 ENDIF END array_equal 722 511 vdimsz 0:1 :BEGIN ORCA05 END ELSE:print vinq name nothing to check ENDCASE x periodicity 1 ncdf_varget cdfid vid part1 count 1 jpj jpk offset 0 0 0 ncdf_varget cdfid vid part2 count 1 jpj jpk offset jpi 2 0 0 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad x periodicity 1 IF keyword_set write THEN ncdf_varput cdfid vid part2 count 1 jpj jpk offset 0 0 0 ENDIF x periodicity 2 ncdf_varget cdfid vid part1 count 1 jpj jpk offset jpi 1 0 0 ncdf_varget cdfid vid part2 count 1 jpj jpk offset 1 0 0 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad x periodicity 2 IF keyword_set write THEN ncdf_varput cdfid vid part2 count 1 jpj jpk offset jpi 1 0 0 ENDIF END 4D VAR 4:BEGIN jpk vdimsz 2 jpt vdimsz 3 y periodicity 1 CASE 1 OF array_equal 182 149 vdimsz 0:1 :BEGIN ORCA2 ncdf_varget cdfid vid part1 count jpi 2 1 jpk jpt offset 1 jpj 1 0 0 ncdf_varget cdfid vid part2 count jpi 2 1 jpk jpt offset 1 jpj 3 0 0 IF jpt EQ 1 THEN part2 reform part2 jpi 2 1 jpk jpt over part2 reverse shift part2 1 0 0 0 1 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad y periodicity 1 IF keyword_set write THEN ncdf_varput cdfid vid part2 count jpi 2 1 jpk jpt offset 1 jpj 1 0 0 ENDIF END array_equal 722 511 vdimsz 0:1 :BEGIN ORCA05 ncdf_varget cdfid vid part1 count jpi 2 1 jpk jpt offset 1 jpj 1 0 0 ncdf_varget cdfid vid part2 count jpi 2 1 jpk jpt offset 1 jpj 2 0 0 IF jpt EQ 1 THEN part2 reform part2 jpi 2 1 jpk jpt over part2 reverse part2 1 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad y periodicity 1 IF keyword_set write THEN ncdf_varput cdfid vid part2 count jpi 2 1 jpk jpt offset 1 jpj 1 0 0 ENDIF END ELSE:print vinq name nothing to check ENDCASE y periodicity 2 CASE 1 OF array_equal 182 149 vdimsz 0:1 :BEGIN ORCA2 ncdf_varget cdfid vid part1 count jpi 1 2 2 1 1 jpk jpt offset jpi 1 2 2 jpj 2 0 0 ncdf_varget cdfid vid part2 count jpi 1 2 2 1 1 jpk jpt offset 2 jpj 2 0 0 part2 reverse part2 1 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad y periodicity 2 IF keyword_set write THEN ncdf_varput cdfid vid part2 count jpi 1 2 2 1 1 jpk jpt offset jpi 1 2 2 jpj 2 0 0 ENDIF END array_equal 722 511 vdimsz 0:1 :BEGIN ORCA05 END ELSE:print vinq name nothing to check ENDCASE x periodicity 1 ncdf_varget cdfid vid part1 count 1 jpj jpk jpt offset 0 0 0 0 ncdf_varget cdfid vid part2 count 1 jpj jpk jpt offset jpi 2 0 0 0 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad x periodicity 1 IF keyword_set write THEN ncdf_varput cdfid vid part2 count 1 jpj jpk jpt offset 0 0 0 0 ENDIF x periodicity 2 ncdf_varget cdfid vid part1 count 1 jpj jpk jpt offset jpi 1 0 0 0 ncdf_varget cdfid vid part2 count 1 jpj jpk jpt offset 1 0 0 0 IF array_equal part1 part2 NE 1 THEN BEGIN print vinq name bad x periodicity 2 IF keyword_set write THEN ncdf_varput cdfid vid part2 count 1 jpj jpk jpt offset jpi 1 0 0 0 ENDIF END ELSE:print vinq name nothing to check ENDCASE ENDIF ENDFOR ncdf_close cdfid RETURN END"); 37 a[35] = new Array("./Grid/computegrid.html", "computegrid.pro", "", " file_comments compute the grid parameters cm_4mesh common domains sizes: jpi jpj jpk jpiglo jpjglo jpkglo jpidta jpjdta jpkdta domains positions regarding to the original grid: ixminmesh ixmaxmesh iyminmesh iymaxmesh izminmesh izmaxmesh ixmindta ixmaxdta iymindta iymaxdta izmindta izmaxdta horizontal parameters: glamt glamf gphit gphit e1t e2t additional horizontal parameters if FULLCGRID keyword is defined: glamu glamv gphiu gphiv e1u e1v e1f e2u e2v e2f verticals parameters: gdept gdepw e3t e3w masks: tmask additional masks if FULLCGRID keyword is defined: umaskred vmaskred fmaskredx fmaskredy triangles_list: triangulation key_ variables: key_onearth key_periodic key_shift key_stride key_partialstep key_yreverse key_zreverse key_gridtype xxx related variables: ccmeshparameters ccreadparameters categories Grid param startx in optional type scalar x starting point optional if XY AXIS keyword is used param starty in optional type scalar y starting point optional if XY AXIS keyword is used param stepxin in optional type scalar or vector x direction step optional if XY AXIS keyword is used must be 0 if stepxin is a vector nx is not used param stepyin in optional type scalar or vector y direction step optional if XY AXIS keyword is used could be 0 south to north or lon1 lon2 lon1 le 360 By default the common cm_4mesh variable key_shift will be automatically defined according to GLAMBOUNDARY keyword MASK default array of 1 type 2D or 3D array Specify the land 0 sea 1 mask keyword ONEARTH default 1 type scalar: 0 or 1 Force the manual definition of data localization on the earth or not 0 if the data are not on the earth 1 if the data are on earth in that case we can for example use the labels longitude latitude in plots The resulting value will be stored in the common cm_4mesh variable key_onearth ONEARTH 0 forces PERIODIC 0 SHIFT 0 and is cancelling GLAMBOUNDARY keyword PERIODIC default computed by using the first line of glamt type scalar: 0 or 1 Force the manual definition of the grid zonal periodicity The resulting value will be stored in the common cm_4mesh variable key_periodic PERIODIC 0 forces SHIFT 0 keyword PLAIN default 0 type scalar: 0 or 1 Force PERIODIC 0 SHIFT 0 STRIDE 1 1 1 and suppress the automatic redefinition of the domain in case of x periodicity overlap y periodicity overlap ORCA type only and mask border to 0 keyword SHIFT default computed according to glamboundary type scalar Force the manual definition of the zonal shift that must be apply to the data The resulting value will be stored in the common cm_4mesh variable key_shift Note that if key_periodic 0 then in any case key_shift 0 keyword STRCALLING type string a string containing the calling command used to call computegrid this is used by xxx pro keyword STRIDE default 1 1 1 type 3 elements vector Specify the stride in x y and z direction The resulting value will be stored in the common cm_4mesh variable key_stride keyword XAXIS type 1D or 2D array Specify longitudes in this case startx stepx and nx are not used but could be necessary if the y axis is not defined with yaxis It must be possible to sort the first line of xaxis in the increasing order by shifting its elements keyword YAXIS type 1D or 2D array Specify latitudes in this case starty stepy and ny are not used but starty and stepy could be necessary if the x axis is not defined with xaxis It must be sorted in the increasing or deceasing order along each column if 2d array keyword XYINDEX activate to specify that the horizontal grid should be simply defined by using the index of the points xaxis findgen nx and yaxis findgen ny using this keyword forces key_onearth 0 keyword XMINMESH default 0L type scalar Define common cm_4mesh variables ixminmesh used to define the localization of the first point of the grid along the x direction in a zoom of the original grid keyword YMINMESH default 0L type scalar Define common cm_4mesh variables iyminmesh used to define the localization of the first point of the grid along the y direction in a zoom of the original grid keyword ZMINMESH default 0L type scalar Define common cm_4mesh variables izminmesh used to define the localization of the first point of the grid along the z direction in a zoom of the original grid keyword XMAXMESH default jpiglo 1 type scalar Define common cm_4mesh variables ixmaxmesh used to define the localization of the last point of the grid along the x direction in a zoom of the original grid Note that if XMAXMESH we are back to a C grid based on T point as for OPA model keyword ROMSH type 2D array This array is the final bathymetry at RHO points It is stored in the common variable cm_4mesh romszinfos h Used when the model is a ROMS C grid with one more point in longitude for T and V grid and one more point in latitude for T and U grid In this case we ignore the last line of T and U points the last column of T and V points we are back to a C grid based on T point as for OPA model Note that activate ROMSH forces FULLCGRID 1 keyword STRCALLING type scalar string Used by xxx keyword ZAXIS type 1D Specify the vertical axis Must be sorted in the increasing or deceasing order keyword _EXTRA not used in the present case uses cm_4mesh cm_4data cm_4cal restrictions if the grid has x y periodicity orverlap and or if the mask has 0 everywhere at the border like a close sea and if we did not activate plain and xminmesh xmaxmesh yminmesh ymaxmesh keywords are defined to their default values we redefine xminmesh xmaxmesh yminmesh ymaxmesh in order to reove the overlapping part and or to open the domain avoid ti be forced to use cell_fill 1 restrictions FUV points definition is not exact if the grid is irregular history Sebastien Masson smasson lodyc jussieu fr 2000 04 20 Sept 2004 several bug fixs to suit C grid type Aug 2005 rewritte almost everything version Id: computegrid pro 202 2007 01 12 11:00:06Z smasson PRO computegrid startx starty stepxin stepyin nxin nyin XAXIS xaxis YAXIS yaxis ZAXIS zaxis MASK mask GLAMBOUNDARY glamboundary XMINMESH xminmesh XMAXMESH xmaxmesh YMINMESH yminmesh YMAXMESH ymaxmesh ZMINMESH zminmesh ZMAXMESH zmaxmesh ONEARTH onearth PERIODIC periodic PLAIN plain SHIFT shift STRIDE stride FULLCGRID fullcgrid XYINDEX xyindex FBASE2TBASE fbase2tbase STRCALLING strcalling ROMSH romsh _extra ex compile_opt idl2 strictarrsubs cm_4mesh cm_4data cm_4cal IF NOT keyword_set key_forgetold THEN BEGIN updatenew updatekwd ENDIF time1 systime 1 for key_performance Check input parameters xaxis related parameters if n_elements xaxis NE 0 then BEGIN CASE size xaxis 0 OF 0:nx 1L 1:nx size xaxis 1 2:nx size xaxis 1 ENDCASE ENDIF ELSE BEGIN IF n_elements startx EQ 0 THEN BEGIN dummy report If xaxis is not given startx must be defined return ENDIF CASE n_elements stepxin OF 0:BEGIN dummy report If xaxis is not given stepxin must be defined return END 1:BEGIN IF n_elements nxin EQ 0 THEN BEGIN dummy report If xaxis is not given and stepxin has only one element nx must be defined return ENDIF ELSE nx nxin END ELSE:nx n_elements stepxin ENDCASE ENDELSE yaxis related parameters if n_elements yaxis NE 0 then BEGIN CASE size yaxis 0 OF 0:ny 1L 1:ny size yaxis 1 2:ny size yaxis 2 ENDCASE ENDIF ELSE BEGIN IF n_elements starty EQ 0 THEN BEGIN dummy report If yaxis is not given starty must be defined return ENDIF CASE n_elements stepyin OF 0:BEGIN dummy report If yaxis is not given stepyin must be defined return END 1:BEGIN IF n_elements nyin EQ 0 THEN BEGIN dummy report If yaxis is not given and stepyin has only one element ny must be defined return ENDIF ELSE ny nyin END ELSE:ny n_elements stepyin ENDCASE ENDELSE zaxis related parameters if n_elements zaxis NE 0 then BEGIN CASE size zaxis 0 OF 0:nz 1L 1:nz size zaxis 1 ELSE:BEGIN print not coded stop END ENDCASE ENDIF ELSE nz 1L Others automatic definitions jpiglo long nx jpjglo long ny jpkglo long nz IF keyword_set romsh THEN BEGIN jpiglo jpiglo 1 jpjglo jpjglo 1 fullcgrid 1 ENDIF impact of plain keyword: IF keyword_set plain THEN BEGIN periodic 0 shift 0 stride 1 1 1 ENDIF IF n_elements xminmesh NE 0 THEN ixminmesh long xminmesh 0 ELSE ixminmesh 0l IF n_elements xmaxmesh NE 0 THEN ixmaxmesh long xmaxmesh 0 ELSE ixmaxmesh jpiglo 1 IF n_elements yminmesh NE 0 THEN iyminmesh long yminmesh 0 ELSE iyminmesh 0l IF n_elements ymaxmesh NE 0 THEN iymaxmesh long ymaxmesh 0 ELSE iymaxmesh jpjglo 1 IF n_elements zminmesh NE 0 THEN izminmesh long zminmesh 0 ELSE izminmesh 0l IF n_elements zmaxmesh NE 0 THEN izmaxmesh long zmaxmesh 0 ELSE izmaxmesh jpkglo 1 iymaxmesh iymaxmesh keyword_set fbase2tbase IF ixmaxmesh LT 0 THEN ixmaxmesh jpiglo 1 ixmaxmesh IF iymaxmesh LT 0 THEN iymaxmesh jpjglo 1 iymaxmesh IF izmaxmesh LT 0 THEN izmaxmesh jpkglo 1 izmaxmesh avoid basics errors ixmaxmesh 0 ixmaxmesh ixminmesh iymaxmesh iyminmesh izmaxmesh izminmesh temporary glamf gphif temporary glamu gphiu temporary glamv gphiv gdept stepz 2 ENDIF ELSE BEGIN stepz 1 gdepw gdept ENDELSE IF keyword_set romsh THEN gdepw gdept e3 tw : e3t stepz IF n_elements stepz GT 1 THEN BEGIN e3w 0 5 stepz shift stepz 1 e3w 0 0 5 e3t 0 ENDIF ELSE e3w e3t Mask default mask eq 1 if NOT keyword_set mask then tmask 1 ELSE tmask mask IF keyword_set romsh AND tmask 0 NE 1 THEN tmask tmask 0:jpiglo 1 0:jpjglo 1 IF array_equal size tmask dimensions jpiglo jpjglo EQ 1AND jpkglo GT 1 THEN BEGIN tmask tmask replicate 1 jpkglo tmask reform tmask jpiglo jpjglo jpkglo overwrite ENDIF IF jpiglo EQ 1 OR jpjglo EQ 1 THEN tmask reform tmask jpiglo jpjglo jpkglo overwrite if tmask 0 NE 1 then BEGIN tmask byte tmask ixminmesh:ixmaxmesh iyminmesh:iymaxmesh izminmesh:izmaxmesh tmask reform tmask jpi jpj jpk over if key_shift NE 0 then tmask shift tmask key_shift 0 0 because tmask reverse tmask 2 is not working if the 3rd dimension of tmask 1 we call reform IF jpk EQ 1 THEN tmask reform tmask over IF key_yreverse EQ 1 THEN tmask reverse tmask 2 IF jpk EQ 1 THEN tmask reform tmask jpi jpj jpk over IF key_zreverse EQ 1 THEN tmask reverse tmask 3 IF jpk EQ 1 THEN tmask reform tmask jpi jpj jpk over IF keyword_set fullcgrid THEN BEGIN IF keyword_set key_periodic THEN BEGIN msk tmask shift tmask 1 0 0 umaskred msk jpi 1 ENDIF ELSE umaskred tmask jpi 1 vmaskred tmask jpj 1 fmaskredy tmask jpi 1 fmaskredx tmask jpj 1 ENDIF ENDIF ELSE BEGIN tmask replicate 1b jpi jpj jpk IF keyword_set fullcgrid THEN BEGIN umaskred replicate 1b jpj jpk vmaskred replicate 1b jpi jpk fmaskredy replicate 1b jpj jpk fmaskredx replicate 1b jpi jpk ENDIF ENDELSE IF jpi GT 2 AND jpj GT 2 AND NOT keyword_set plain AND ixminmesh EQ 0l AND ixmaxmesh eq jpiglo 1 AND iyminmesh EQ 0l AND iymaxmesh eq jpjglo 1 AND total tmask 0 EQ 0 AND total tmask jpj 1 EQ 0 AND total tmask 0 EQ 0 AND total tmask jpi 1 EQ 0 THEN BEGIN xminmesh 1 xmaxmesh 1 yminmesh 1 ymaxmesh 1 computegrid XAXIS glamt YAXIS gphit ZAXIS zaxis MASK mask GLAMBOUNDARY glamboundary XMINMESH xminmesh XMAXMESH xmaxmesh YMINMESH yminmesh YMAXMESH ymaxmesh ZMINMESH zminmesh ZMAXMESH zmaxmesh ONEARTH onearth PERIODIC periodic PLAIN plain SHIFT shift STRIDE stride FULLCGRID fullcgrid XYINDEX xyindex FBASE2TBASE fbase2tbase STRCALLING strcalling ROMSH romsh _extra ex return ENDIF IF NOT keyword_set fullcgrid THEN BEGIN umaskred values f_nan vmaskred values f_nan fmaskredy values f_nan fmaskredx values f_nan ENDIF stride IF total key_stride GT 3 THEN BEGIN IF key_shift NE 0 THEN BEGIN for explanation see header of read_ncdf_varget pro jpiright key_shift jpileft jpi key_shift key_stride 0 1 key_shift 1 MOD key_stride 0 jpi jpiright 1 key_stride 0 1 jpileft 1 key_stride 0 1 ENDIF ELSE jpi jpi 1 key_stride 0 1 jpj jpj 1 key_stride 1 1 jpk jpk 1 key_stride 2 1 glamt temporary glamt 0: :stride 0 0: :stride 1 gphit temporary gphit 0: :stride 0 0: :stride 1 e1t temporary e1t 0: :stride 0 0: :stride 1 e2t temporary e2t 0: :stride 0 0: :stride 1 tmask temporary tmask 0: :stride 0 0: :stride 1 0: :stride 2 gdept gdept 0: :stride 2 gdepw gdepw 0: :stride 2 e3t e3t 0: :stride 2 e3w e3w 0: :stride 2 we must recompute glamf and gphif IF jpi GT 1 THEN BEGIN if keyword_set key_onearth AND keyword_set xnotsorted OR keyword_set key_periodic AND key_irregular then BEGIN stepxf glamt 720 MOD 360 stepxf shift stepxf 1 1 stepxf stepxf stepxf stepxf 360 stepxf 360 stepxf min abs stepxf dimension 3 IF NOT keyword_set key_periodic THEN stepxf jpi 1 stepxf jpi 2 ENDIF ELSE BEGIN stepxf shift glamt 1 1 glamt IF keyword_set key_periodic THEN stepxf jpi 1 360 stepxf jpi 1 ELSE stepxf jpi 1 stepxf jpi 2 ENDELSE IF jpj GT 1 THEN BEGIN stepxf jpj 1 stepxf jpj 2 stepxf jpi 1 jpj 1 stepxf jpi 2 jpj 2 ENDIF glamf glamt 0 5 stepxf ENDIF ELSE glamf glamt 0 5 IF jpj GT 1 THEN BEGIN we must compute stepyf: y distance between T i j T i 1 j 1 stepyf shift gphit 1 1 gphit stepyf jpj 1 stepyf jpj 2 IF jpi GT 1 THEN BEGIN if NOT keyword_set key_periodic THEN stepyf jpi 1 stepyf jpi 2 stepyf jpi 1 jpj 1 stepyf jpi 2 jpj 2 ENDIF gphif gphit 0 5 stepyf ENDIF ELSE gphif gphit 0 5 IF jpj EQ 1 THEN BEGIN glamt reform glamt jpi jpj over gphit reform gphit jpi jpj over glamf reform glamf jpi jpj over gphif reform gphif jpi jpj over e1t reform e1t jpi jpj over e2t reform e2t jpi jpj over ENDIF IF keyword_set fullcgrid THEN BEGIN glamu temporary glamu 0: :stride 0 0: :stride 1 gphiu temporary gphiu 0: :stride 0 0: :stride 1 e1u temporary e1u 0: :stride 0 0: :stride 1 e2u temporary e2u 0: :stride 0 0: :stride 1 glamv temporary glamv 0: :stride 0 0: :stride 1 gphiv temporary gphiv 0: :stride 0 0: :stride 1 e1v temporary e1v 0: :stride 0 0: :stride 1 e2v temporary e2v 0: :stride 0 0: :stride 1 e1f temporary e1f 0: :stride 0 0: :stride 1 e2f temporary e2f 0: :stride 0 0: :stride 1 umaskred temporary umaskred 0 0: :stride 1 0: :stride 2 vmaskred temporary vmaskred 0: :stride 0 0 0: :stride 2 fmaskredy temporary fmaskredy 0 0: :stride 1 0: :stride 2 fmaskredx temporary fmaskredx 0: :stride 0 0 0: :stride 2 IF jpj EQ 1 THEN BEGIN glamu reform glamu jpi jpj over gphiu reform gphiu jpi jpj over e1u reform e1u jpi jpj over e2u reform e2u jpi jpj over glamv reform glamv jpi jpj over gphiv reform gphiv jpi jpj over e1v reform e1v jpi jpj over e2v reform e2v jpi jpj over e1f reform e1f jpi jpj over e2f reform e2f jpi jpj over ENDIF ENDIF ENDIF apply all the grid parameters updateold domdef Triangulation IF total tmask EQ jpi jpj jpk AND NOT keyword_set key_irregular THEN triangles_list 1 ELSE BEGIN are we using ORCA2 IF jpiglo EQ 182 AND jpi EQ 181 AND jpjglo EQ 149 AND jpj EQ 148 THEN triangles_list triangule ELSE triangles_list triangule keep_cont ENDELSE time axis default definition IF n_elements time EQ 0 OR n_elements jpt EQ 0 THEN BEGIN jpt 1 time 0 ENDIF IF NOT keyword_set key_forgetold THEN BEGIN updateold ENDIF grid parameters used by xxx IF NOT keyword_set strcalling THEN BEGIN IF n_elements ccmeshparameters EQ 0 THEN strcalling computegrid ELSE strcalling ccmeshparameters filename ENDIF IF n_elements glamt GE 2 THEN BEGIN glaminfo moment glamt IF finite glaminfo 2 EQ 0 THEN glaminfo glaminfo 0:1 gphiinfo moment gphit IF finite gphiinfo 2 EQ 0 THEN gphiinfo gphiinfo 0:1 ENDIF ELSE BEGIN glaminfo glamt gphiinfo gphit ENDELSE IF keyword_set romsh THEN romszinfos h:romsh ixminmesh:ixmaxmesh iyminmesh:iymaxmesh zeta:replicate 0 jpi jpj theta_s: 1 theta_b: 1 hc: 1 ELSE romszinfos h: 1 zeta: 1 theta_s: 1 theta_b: 1 hc: 1 ccmeshparameters filename:strcalling glaminfo:float string glaminfo format E11 4 gphiinfo:float string gphiinfo format E11 4 jpiglo:jpiglo jpjglo:jpjglo jpkglo:jpkglo jpi:jpi jpj:jpj jpk:jpk ixminmesh:ixminmesh ixmaxmesh:ixmaxmesh iyminmesh:iyminmesh iymaxmesh:iymaxmesh izminmesh:izminmesh izmaxmesh:izmaxmesh key_shift:key_shift key_periodic:key_periodic key_stride:key_stride key_gridtype:key_gridtype key_yreverse:key_yreverse key_zreverse:key_zreverse key_partialstep:key_partialstep key_onearth:key_onearth ccreadparameters funclec_name: read_ncdf jpidta:jpidta jpjdta:jpjdta jpkdta:jpkdta ixmindta:ixmindta ixmaxdta:ixmaxdta iymindta:iymindta iymaxdta:iymaxdta izmindta:izmindta izmaxdta:izmaxdta IF keyword_set key_performance EQ 1 THEN print time computegrid systime 1 time1 return end");37 a[35] = new Array("./Grid/computegrid.html", "computegrid.pro", "", " file_comments compute the grid parameters cm_4mesh common domains sizes: jpi jpj jpk jpiglo jpjglo jpkglo jpidta jpjdta jpkdta domains positions regarding to the original grid: ixminmesh ixmaxmesh iyminmesh iymaxmesh izminmesh izmaxmesh ixmindta ixmaxdta iymindta iymaxdta izmindta izmaxdta horizontal parameters: glamt glamf gphit gphit e1t e2t additional horizontal parameters if FULLCGRID keyword is defined: glamu glamv gphiu gphiv e1u e1v e1f e2u e2v e2f verticals parameters: gdept gdepw e3t e3w masks: tmask additional masks if FULLCGRID keyword is defined: umaskred vmaskred fmaskredx fmaskredy triangles_list: triangulation key_ variables: key_onearth key_periodic key_shift key_stride key_partialstep key_yreverse key_zreverse key_gridtype xxx related variables: ccmeshparameters ccreadparameters categories Grid param startx in optional type scalar x starting point optional if XY AXIS keyword is used param starty in optional type scalar y starting point optional if XY AXIS keyword is used param stepxin in optional type scalar or vector x direction step optional if XY AXIS keyword is used must be 0 if stepxin is a vector nx is not used param stepyin in optional type scalar or vector y direction step optional if XY AXIS keyword is used could be 0 south to north or lon1 lon2 lon1 le 360 By default the common cm_4mesh variable key_shift will be automatically defined according to GLAMBOUNDARY keyword MASK default array of 1 type 2D or 3D array Specify the land 0 sea 1 mask keyword ONEARTH default 1 type scalar: 0 or 1 Force the manual definition of data localization on the earth or not 0 if the data are not on the earth 1 if the data are on earth in that case we can for example use the labels longitude latitude in plots The resulting value will be stored in the common cm_4mesh variable key_onearth ONEARTH 0 forces PERIODIC 0 SHIFT 0 and is cancelling GLAMBOUNDARY keyword PERIODIC default computed by using the first line of glamt type scalar: 0 or 1 Force the manual definition of the grid zonal periodicity The resulting value will be stored in the common cm_4mesh variable key_periodic PERIODIC 0 forces SHIFT 0 keyword PLAIN default 0 type scalar: 0 or 1 Force PERIODIC 0 SHIFT 0 STRIDE 1 1 1 and suppress the automatic redefinition of the domain in case of x periodicity overlap y periodicity overlap ORCA type only and mask border to 0 keyword SHIFT default computed according to glamboundary type scalar Force the manual definition of the zonal shift that must be apply to the data The resulting value will be stored in the common cm_4mesh variable key_shift Note that if key_periodic 0 then in any case key_shift 0 keyword STRCALLING type string a string containing the calling command used to call computegrid this is used by xxx pro keyword STRIDE default 1 1 1 type 3 elements vector Specify the stride in x y and z direction The resulting value will be stored in the common cm_4mesh variable key_stride keyword XAXIS type 1D or 2D array Specify longitudes in this case startx stepx and nx are not used but could be necessary if the y axis is not defined with yaxis It must be possible to sort the first line of xaxis in the increasing order by shifting its elements keyword YAXIS type 1D or 2D array Specify latitudes in this case starty stepy and ny are not used but starty and stepy could be necessary if the x axis is not defined with xaxis It must be sorted in the increasing or deceasing order along each column if 2d array keyword XYINDEX activate to specify that the horizontal grid should be simply defined by using the index of the points xaxis findgen nx and yaxis findgen ny using this keyword forces key_onearth 0 keyword XMINMESH default 0L type scalar Define common cm_4mesh variables ixminmesh used to define the localization of the first point of the grid along the x direction in a zoom of the original grid keyword YMINMESH default 0L type scalar Define common cm_4mesh variables iyminmesh used to define the localization of the first point of the grid along the y direction in a zoom of the original grid keyword ZMINMESH default 0L type scalar Define common cm_4mesh variables izminmesh used to define the localization of the first point of the grid along the z direction in a zoom of the original grid keyword XMAXMESH default jpiglo 1 type scalar Define common cm_4mesh variables ixmaxmesh used to define the localization of the last point of the grid along the x direction in a zoom of the original grid Note that if XMAXMESH we are back to a C grid based on T point as for OPA model Note that in that case key_gridtype c_f and not c used in read_ncdf Note that activate FBASE2TBASE forces FULLCGRID 1 keyword UBASE2TBASE Activate when the model is a C grid based on a U point with a U point at the bottom left corner and a T point at the upper right corner In this case we ignore if the grid is not x periodic the first column of F and U points if the grid is not x periodic the last column of T and V points we are back to a C grid based on T point as for OPA model Note that in that case key_gridtype c_u and not c used in read_ncdf Note that activate UBASE2TBASE forces FULLCGRID 1 keyword VBASE2TBASE Activate when the model is a C grid based on a V point with a V point at the bottom left corner and a T point at the upper right corner In this case we ignore the first line of F and V points the last line of T and U points we are back to a C grid based on T point as for OPA model Note that in that case key_gridtype c_v and not c used in read_ncdf Note that activate VBASE2TBASE forces FULLCGRID 1 keyword ROMSH type 2D array This array is the final bathymetry at RHO points It is stored in the common variable cm_4mesh romszinfos h Used when the model is a ROMS C grid with one more point in longitude for T and V grid and one more point in latitude for T and U grid In this case we ignore the last line of T and U points the last column of T and V points we are back to a C grid based on T point as for OPA model Note that activate ROMSH forces FULLCGRID 1 keyword STRCALLING type scalar string Used by xxx keyword ZAXIS type 1D Specify the vertical axis Must be sorted in the increasing or deceasing order keyword _EXTRA not used in the present case uses cm_4mesh cm_4data cm_4cal restrictions if the grid has x y periodicity orverlap and or if the mask has 0 everywhere at the border like a close sea and if we did not activate plain and xminmesh xmaxmesh yminmesh ymaxmesh keywords are defined to their default values we redefine xminmesh xmaxmesh yminmesh ymaxmesh in order to reove the overlapping part and or to open the domain avoid ti be forced to use cell_fill 1 restrictions FUV points definition is not exact if the grid is irregular history Sebastien Masson smasson lodyc jussieu fr 2000 04 20 Sept 2004 several bug fixs to suit C grid type Aug 2005 rewritte almost everything version Id: computegrid pro 209 2007 02 08 10:01:49Z smasson PRO computegrid startx starty stepxin stepyin nxin nyin XAXIS xaxis YAXIS yaxis ZAXIS zaxis MASK mask GLAMBOUNDARY glamboundary XMINMESH xminmesh XMAXMESH xmaxmesh YMINMESH yminmesh YMAXMESH ymaxmesh ZMINMESH zminmesh ZMAXMESH zmaxmesh ONEARTH onearth PERIODIC periodic PLAIN plain SHIFT shift STRIDE stride FULLCGRID fullcgrid XYINDEX xyindex UBASE2TBASE ubase2tbase VBASE2TBASE vbase2tbase FBASE2TBASE fbase2tbase STRCALLING strcalling ROMSH romsh _extra ex compile_opt idl2 strictarrsubs cm_4mesh cm_4data cm_4cal IF NOT keyword_set key_forgetold THEN BEGIN updatenew updatekwd ENDIF time1 systime 1 for key_performance Check input parameters xaxis related parameters if n_elements xaxis NE 0 then BEGIN CASE size xaxis 0 OF 0:nx 1L 1:nx size xaxis 1 2:nx size xaxis 1 ENDCASE ENDIF ELSE BEGIN IF n_elements startx EQ 0 THEN BEGIN dummy report If xaxis is not given startx must be defined return ENDIF CASE n_elements stepxin OF 0:BEGIN dummy report If xaxis is not given stepxin must be defined return END 1:BEGIN IF n_elements nxin EQ 0 THEN BEGIN dummy report If xaxis is not given and stepxin has only one element nx must be defined return ENDIF ELSE nx nxin END ELSE:nx n_elements stepxin ENDCASE ENDELSE yaxis related parameters if n_elements yaxis NE 0 then BEGIN CASE size yaxis 0 OF 0:ny 1L 1:ny size yaxis 1 2:ny size yaxis 2 ENDCASE ENDIF ELSE BEGIN IF n_elements starty EQ 0 THEN BEGIN dummy report If yaxis is not given starty must be defined return ENDIF CASE n_elements stepyin OF 0:BEGIN dummy report If yaxis is not given stepyin must be defined return END 1:BEGIN IF n_elements nyin EQ 0 THEN BEGIN dummy report If yaxis is not given and stepyin has only one element ny must be defined return ENDIF ELSE ny nyin END ELSE:ny n_elements stepyin ENDCASE ENDELSE zaxis related parameters if n_elements zaxis NE 0 then BEGIN CASE size zaxis 0 OF 0:nz 1L 1:nz size zaxis 1 ELSE:BEGIN print not coded stop END ENDCASE ENDIF ELSE nz 1L Others automatic definitions jpiglo long nx jpjglo long ny jpkglo long nz IF keyword_set romsh THEN BEGIN jpiglo jpiglo 1 jpjglo jpjglo 1 fullcgrid 1 ENDIF impact of plain keyword: IF keyword_set plain THEN BEGIN periodic 0 shift 0 stride 1 1 1 ENDIF IF n_elements xminmesh NE 0 THEN ixminmesh long xminmesh 0 ELSE ixminmesh 0l IF n_elements xmaxmesh NE 0 THEN ixmaxmesh long xmaxmesh 0 ELSE ixmaxmesh jpiglo 1 IF n_elements yminmesh NE 0 THEN iyminmesh long yminmesh 0 ELSE iyminmesh 0l IF n_elements ymaxmesh NE 0 THEN iymaxmesh long ymaxmesh 0 ELSE iymaxmesh jpjglo 1 IF n_elements zminmesh NE 0 THEN izminmesh long zminmesh 0 ELSE izminmesh 0l IF n_elements zmaxmesh NE 0 THEN izmaxmesh long zmaxmesh 0 ELSE izmaxmesh jpkglo 1 CASE 1 OF keyword_set fbase2tbase :key_gridtype c_f keyword_set ubase2tbase :key_gridtype c_u keyword_set vbase2tbase :key_gridtype c_v else:key_gridtype c ENDCASE IF key_gridtype EQ c_v OR key_gridtype EQ c_f THEN BEGIN iymaxmesh iymaxmesh 1 ENDIF IF strlen key_gridtype EQ 3 THEN fullcgrid 1 IF ixmaxmesh LT 0 THEN ixmaxmesh jpiglo 1 ixmaxmesh IF iymaxmesh LT 0 THEN iymaxmesh jpjglo 1 iymaxmesh IF izmaxmesh LT 0 THEN izmaxmesh jpkglo 1 izmaxmesh avoid basics errors ixmaxmesh 0 ixmaxmesh ixminmesh iymaxmesh iyminmesh izmaxmesh izminmesh temporary glamf gphif temporary glamu gphiu temporary glamv gphiv gdept stepz 2 ENDIF ELSE BEGIN stepz 1 gdepw gdept ENDELSE IF keyword_set romsh THEN gdepw gdept e3 tw : e3t stepz IF n_elements stepz GT 1 THEN BEGIN e3w 0 5 stepz shift stepz 1 e3w 0 0 5 e3t 0 ENDIF ELSE e3w e3t Mask default mask eq 1 if NOT keyword_set mask then tmask 1 ELSE tmask mask IF keyword_set romsh AND tmask 0 NE 1 THEN tmask tmask 0:jpiglo 1 0:jpjglo 1 IF n_elements mask EQ jpiglo jpjglo AND jpkglo GT 1 THEN BEGIN tmask tmask replicate 1 jpkglo tmask reform tmask jpiglo jpjglo jpkglo overwrite ENDIF IF jpiglo EQ 1 OR jpjglo EQ 1 THEN tmask reform tmask jpiglo jpjglo jpkglo overwrite if tmask 0 NE 1 then BEGIN tmask byte tmask ixminmesh:ixmaxmesh iyminmesh:iymaxmesh izminmesh:izmaxmesh tmask reform tmask jpi jpj jpk over if key_shift NE 0 then tmask shift tmask key_shift 0 0 because tmask reverse tmask 2 is not working if the 3rd dimension of tmask 1 we call reform IF jpk EQ 1 THEN tmask reform tmask over IF key_yreverse EQ 1 THEN tmask reverse tmask 2 IF jpk EQ 1 THEN tmask reform tmask jpi jpj jpk over IF key_zreverse EQ 1 THEN tmask reverse tmask 3 IF jpk EQ 1 THEN tmask reform tmask jpi jpj jpk over IF keyword_set fullcgrid THEN BEGIN IF keyword_set key_periodic THEN BEGIN msk tmask shift tmask 1 0 0 umaskred msk jpi 1 ENDIF ELSE umaskred tmask jpi 1 vmaskred tmask jpj 1 fmaskredy tmask jpi 1 fmaskredx tmask jpj 1 ENDIF ENDIF ELSE BEGIN tmask replicate 1b jpi jpj jpk IF keyword_set fullcgrid THEN BEGIN umaskred replicate 1b jpj jpk vmaskred replicate 1b jpi jpk fmaskredy replicate 1b jpj jpk fmaskredx replicate 1b jpi jpk ENDIF ENDELSE IF jpi GT 2 AND jpj GT 2 AND NOT keyword_set plain AND ixminmesh EQ 0l AND ixmaxmesh eq jpiglo 1 AND iyminmesh EQ 0l AND iymaxmesh eq jpjglo 1 AND total tmask 0 EQ 0 AND total tmask jpj 1 EQ 0 AND total tmask 0 EQ 0 AND total tmask jpi 1 EQ 0 THEN BEGIN xminmesh 1 xmaxmesh 1 yminmesh 1 ymaxmesh 1 computegrid XAXIS glamt YAXIS gphit ZAXIS zaxis MASK mask GLAMBOUNDARY glamboundary XMINMESH xminmesh XMAXMESH xmaxmesh YMINMESH yminmesh YMAXMESH ymaxmesh ZMINMESH zminmesh ZMAXMESH zmaxmesh ONEARTH onearth PERIODIC periodic PLAIN plain SHIFT shift STRIDE stride FULLCGRID fullcgrid XYINDEX xyindex FBASE2TBASE fbase2tbase STRCALLING strcalling ROMSH romsh _extra ex return ENDIF IF NOT keyword_set fullcgrid THEN BEGIN umaskred values f_nan vmaskred values f_nan fmaskredy values f_nan fmaskredx values f_nan ENDIF stride IF total key_stride GT 3 THEN BEGIN IF key_shift NE 0 THEN BEGIN for explanation see header of read_ncdf_varget pro jpiright key_shift jpileft jpi key_shift key_stride 0 1 key_shift 1 MOD key_stride 0 jpi jpiright 1 key_stride 0 1 jpileft 1 key_stride 0 1 ENDIF ELSE jpi jpi 1 key_stride 0 1 jpj jpj 1 key_stride 1 1 jpk jpk 1 key_stride 2 1 glamt temporary glamt 0: :stride 0 0: :stride 1 gphit temporary gphit 0: :stride 0 0: :stride 1 e1t temporary e1t 0: :stride 0 0: :stride 1 e2t temporary e2t 0: :stride 0 0: :stride 1 tmask temporary tmask 0: :stride 0 0: :stride 1 0: :stride 2 gdept gdept 0: :stride 2 gdepw gdepw 0: :stride 2 e3t e3t 0: :stride 2 e3w e3w 0: :stride 2 we must recompute glamf and gphif IF jpi GT 1 THEN BEGIN if keyword_set key_onearth AND keyword_set xnotsorted OR keyword_set key_periodic AND key_irregular then BEGIN stepxf glamt 720 MOD 360 stepxf shift stepxf 1 1 stepxf stepxf stepxf stepxf 360 stepxf 360 stepxf min abs stepxf dimension 3 IF NOT keyword_set key_periodic THEN stepxf jpi 1 stepxf jpi 2 ENDIF ELSE BEGIN stepxf shift glamt 1 1 glamt IF keyword_set key_periodic THEN stepxf jpi 1 360 stepxf jpi 1 ELSE stepxf jpi 1 stepxf jpi 2 ENDELSE IF jpj GT 1 THEN BEGIN stepxf jpj 1 stepxf jpj 2 stepxf jpi 1 jpj 1 stepxf jpi 2 jpj 2 ENDIF glamf glamt 0 5 stepxf ENDIF ELSE glamf glamt 0 5 IF jpj GT 1 THEN BEGIN we must compute stepyf: y distance between T i j T i 1 j 1 stepyf shift gphit 1 1 gphit stepyf jpj 1 stepyf jpj 2 IF jpi GT 1 THEN BEGIN if NOT keyword_set key_periodic THEN stepyf jpi 1 stepyf jpi 2 stepyf jpi 1 jpj 1 stepyf jpi 2 jpj 2 ENDIF gphif gphit 0 5 stepyf ENDIF ELSE gphif gphit 0 5 IF jpj EQ 1 THEN BEGIN glamt reform glamt jpi jpj over gphit reform gphit jpi jpj over glamf reform glamf jpi jpj over gphif reform gphif jpi jpj over e1t reform e1t jpi jpj over e2t reform e2t jpi jpj over ENDIF IF keyword_set fullcgrid THEN BEGIN glamu temporary glamu 0: :stride 0 0: :stride 1 gphiu temporary gphiu 0: :stride 0 0: :stride 1 e1u temporary e1u 0: :stride 0 0: :stride 1 e2u temporary e2u 0: :stride 0 0: :stride 1 glamv temporary glamv 0: :stride 0 0: :stride 1 gphiv temporary gphiv 0: :stride 0 0: :stride 1 e1v temporary e1v 0: :stride 0 0: :stride 1 e2v temporary e2v 0: :stride 0 0: :stride 1 e1f temporary e1f 0: :stride 0 0: :stride 1 e2f temporary e2f 0: :stride 0 0: :stride 1 umaskred temporary umaskred 0 0: :stride 1 0: :stride 2 vmaskred temporary vmaskred 0: :stride 0 0 0: :stride 2 fmaskredy temporary fmaskredy 0 0: :stride 1 0: :stride 2 fmaskredx temporary fmaskredx 0: :stride 0 0 0: :stride 2 IF jpj EQ 1 THEN BEGIN glamu reform glamu jpi jpj over gphiu reform gphiu jpi jpj over e1u reform e1u jpi jpj over e2u reform e2u jpi jpj over glamv reform glamv jpi jpj over gphiv reform gphiv jpi jpj over e1v reform e1v jpi jpj over e2v reform e2v jpi jpj over e1f reform e1f jpi jpj over e2f reform e2f jpi jpj over ENDIF ENDIF ENDIF apply all the grid parameters updateold domdef Triangulation IF total tmask EQ jpi jpj jpk AND NOT keyword_set key_irregular THEN triangles_list 1 ELSE BEGIN are we using ORCA2 IF jpiglo EQ 182 AND jpi EQ 181 AND jpjglo EQ 149 AND jpj EQ 148 THEN triangles_list triangule ELSE triangles_list triangule keep_cont ENDELSE time axis default definition IF n_elements time EQ 0 OR n_elements jpt EQ 0 THEN BEGIN jpt 1 time 0 ENDIF IF NOT keyword_set key_forgetold THEN BEGIN updateold ENDIF grid parameters used by xxx IF NOT keyword_set strcalling THEN BEGIN IF n_elements ccmeshparameters EQ 0 THEN strcalling computegrid ELSE strcalling ccmeshparameters filename ENDIF IF n_elements glamt GE 2 THEN BEGIN glaminfo moment glamt IF finite glaminfo 2 EQ 0 THEN glaminfo glaminfo 0:1 gphiinfo moment gphit IF finite gphiinfo 2 EQ 0 THEN gphiinfo gphiinfo 0:1 ENDIF ELSE BEGIN glaminfo glamt gphiinfo gphit ENDELSE IF keyword_set romsh THEN romszinfos h:romsh ixminmesh:ixmaxmesh iyminmesh:iymaxmesh zeta:replicate 0 jpi jpj theta_s: 1 theta_b: 1 hc: 1 ELSE romszinfos h: 1 zeta: 1 theta_s: 1 theta_b: 1 hc: 1 ccmeshparameters filename:strcalling glaminfo:float string glaminfo format E11 4 gphiinfo:float string gphiinfo format E11 4 jpiglo:jpiglo jpjglo:jpjglo jpkglo:jpkglo jpi:jpi jpj:jpj jpk:jpk ixminmesh:ixminmesh ixmaxmesh:ixmaxmesh iyminmesh:iyminmesh iymaxmesh:iymaxmesh izminmesh:izminmesh izmaxmesh:izmaxmesh key_shift:key_shift key_periodic:key_periodic key_stride:key_stride key_gridtype:key_gridtype key_yreverse:key_yreverse key_zreverse:key_zreverse key_partialstep:key_partialstep key_onearth:key_onearth ccreadparameters funclec_name: read_ncdf jpidta:jpidta jpjdta:jpjdta jpkdta:jpkdta ixmindta:ixmindta ixmaxdta:ixmaxdta iymindta:iymindta iymaxdta:iymaxdta izmindta:izmindta izmaxdta:izmaxdta IF keyword_set key_performance EQ 1 THEN print time computegrid systime 1 time1 return end"); 38 38 a[36] = new Array("./Grid/micromeshmask.html", "micromeshmask.pro", "", " file_comments Reduce the size of the NetCDF meshmask created by OPA by using bit and not byte format for the masks and the float format for the other fields categories For OPA param inid in required param outid in required param inname in required param outname in optional history July 2004 Sebastien Masson smasson lodyc jussieu fr version Id: micromeshmask pro 157 2006 08 21 09:01:50Z navarro PRO ncdf_transfer inid outid inname outname compile_opt idl2 strictarrsubs IF n_elements outname EQ 0 THEN outname inname ncdf_varget inid inname zzz ncdf_varput outid outname float reform zzz over RETURN END param ncfilein in required 1 the name of the meshmask file to be reduced In that case there is only one meshmask file OR 2 the xxx part in the names: xxx mesh_hgr nc xxx mesh_zgr nc xxx mask nc In that case the meshmask is split into 3 files param ncfileout in optional the name of the uniq reduced meshmask file default definition is micromeshmask nc keyword IODIR to define the files path examples IDL meshdir d1fes2 raid2 smasson DATA ORCA05 IDL micromeshmask meshmask_ORCA_R05 nc iodir meshdir PRO micromeshmask ncfilein ncfileout IODIR iodir compile_opt idl2 strictarrsubs filein isafile FILE ncfilein IODIR iodir NEW test findfile filein 0 IF test EQ THEN BEGIN filein_hgr findfile filein mesh_hgr nc 0 filein_zgr findfile filein mesh_zgr nc 0 filein_msk findfile filein mask nc 0 IF filein_hgr EQ OR filein_zgr EQ OR filein_msk EQ THEN BEGIN print meshmask file s not found print filein does not exist print filein mesh_hgr nc does not exist print filein mesh_zgr nc does not exist print filein mask nc does not exist return ENDIF ENDIF ELSE filein test get the horizontal dimensions IF n_elements filein_hgr NE 0 THEN cdfid ncdf_open filein_hgr ELSE cdfid ncdf_open filein ncdf_diminq cdfid x name jpi ncdf_diminq cdfid y name jpj for the mask we use its byte representation its y dimension will be extended to be a multiple of 8 then it will be divided by 8 if jpj mod 8 eq 0 the jpj_m jpi 8 else jpj_m jpi 8 1 jpj_m jpj 7 8 get the vertical dimensions IF n_elements filein_zgr NE 0 THEN BEGIN ncdf_close cdfid cdfid ncdf_open filein_zgr ENDIF listdims strlowcase ncdf_listdims cdfid IF where listdims EQ z 0 NE 1 THEN ncdf_diminq cdfid z name jpk ELSE BEGIN dimid where strmid listdims 0 5 EQ depth 0 IF dimid NE 1 THEN ncdf_diminq cdfid dimid name jpk ELSE BEGIN dummy report We could not find the vertical dimension its name must be z or start with depth return ENDELSE ENDELSE get the variables list related to the partial steps varlist_ps ncdf_listvars cdfid varlist_ps strtrim strlowcase varlist_ps 2 define the output file IF n_elements ncfileout EQ 0 THEN ncfileout micromeshmask nc cdfidout ncdf_create isafile FILE ncfileout IODIR iodir NEW clobber ncdf_control cdfidout nofill dimension dimidx ncdf_dimdef cdfidout x jpi dimidy ncdf_dimdef cdfidout y jpj dimidy_m ncdf_dimdef cdfidout y_m jpj_m dimidz ncdf_dimdef cdfidout z jpk global attributs ncdf_attput cdfidout IDL_Program_Name micromeshmask pro GLOBAL ncdf_attput cdfidout Creation_Date systime GLOBAL declaration des variables varid lonarr 20 horizontal variables hgrlist glamt glamu glamv glamf gphit gphiu gphiv gphif e1t e1u e1v e1f e2t e2u e2v e2f FOR h 0 n_elements hgrlist 1 DO varid h ncdf_vardef cdfidout hgrlist h dimidx dimidy float vertical variables zgrlist e3t e3w gdept gdepw FOR z 0 n_elements zgrlist 1 DO varid 16 z ncdf_vardef cdfidout zgrlist z dimidz float variables related to the partial steps IF where varlist_ps EQ hdept 0 NE 1 THEN varid varid ncdf_vardef cdfidout hdept dimidx dimidy float IF where varlist_ps EQ hdepw 0 NE 1 THEN varid varid ncdf_vardef cdfidout hdepw dimidx dimidy float old variable name keep for compatibility with old run Change e3tp to e3t_ps IF where varlist_ps EQ e3tp 0 NE 1 THEN varid varid ncdf_vardef cdfidout e3t_ps dimidx dimidy float old variable name keep for compatibility with old run Change e3wp to e3w_ps IF where varlist_ps EQ e3wp 0 NE 1 THEN varid varid ncdf_vardef cdfidout e3w_ps dimidx dimidy float IF where varlist_ps EQ e3t_ps 0 NE 1 THEN varid varid ncdf_vardef cdfidout e3t_ps dimidx dimidy float IF where varlist_ps EQ e3w_ps 0 NE 1 THEN varid varid ncdf_vardef cdfidout e3w_ps dimidx dimidy float IF where varlist_ps EQ e3u_ps 0 NE 1 THEN varid varid ncdf_vardef cdfidout e3u_ps dimidx dimidy float IF where varlist_ps EQ e3v_ps 0 NE 1 THEN varid varid ncdf_vardef cdfidout e3v_ps dimidx dimidy float mask variable msklist tmask umask vmask fmask FOR m 0 n_elements msklist 1 DO BEGIN varid varid ncdf_vardef cdfidout msklist m dimidx dimidy_m dimidz byte ncdf_attput cdfidout varid n_elements varid 1 Comment the mask is stored as bit You must use the binary representation of the byte to get back the data ENDFOR ncdf_control cdfidout endef get the horizontal variables IF n_elements filein_hgr NE 0 THEN BEGIN ncdf_close cdfid cdfid ncdf_open filein_hgr ENDIF FOR h 0 n_elements hgrlist 1 DO ncdf_transfer cdfid cdfidout hgrlist h get the vertical variables IF n_elements filein_zgr NE 0 THEN BEGIN ncdf_close cdfid cdfid ncdf_open filein_zgr ENDIF FOR z 0 n_elements zgrlist 1 DO ncdf_transfer cdfid cdfidout zgrlist z partial step variables IF where varlist_ps EQ hdept 0 NE 1 THEN ncdf_transfer cdfid cdfidout hdept IF where varlist_ps EQ hdepw 0 NE 1 THEN ncdf_transfer cdfid cdfidout hdepw IF where varlist_ps EQ e3tp 0 NE 1 THEN ncdf_transfer cdfid cdfidout e3tp e3t_ps IF where varlist_ps EQ e3wp 0 NE 1 THEN ncdf_transfer cdfid cdfidout e3wp e3w_ps IF where varlist_ps EQ e3t_ps 0 NE 1 THEN ncdf_transfer cdfid cdfidout e3t_ps IF where varlist_ps EQ e3w_ps 0 NE 1 THEN ncdf_transfer cdfid cdfidout e3w_ps IF where varlist_ps EQ e3u_ps 0 NE 1 THEN ncdf_transfer cdfid cdfidout e3u_ps IF where varlist_ps EQ e3v_ps 0 NE 1 THEN ncdf_transfer cdfid cdfidout e3v_ps mask IF n_elements filein_msk NE 0 THEN BEGIN ncdf_close cdfid cdfid ncdf_open filein_msk ENDIF loop on the vertical levels to limit the memory use FOR k 0 jpk 1 DO BEGIN FOR m 0 3 DO BEGIN CASE ncdf_varinq cdfid msklist m ndims OF 3:ncdf_varget cdfid msklist m zzz offset 0 0 k count jpi jpj 1 4:ncdf_varget cdfid msklist m zzz offset 0 0 k 0 count jpi jpj 1 1 ENDCASE zzz byte temporary zzz zzz must contain only 0 or 1 zzz temporary zzz MOD 2 we transpose zzz because we need to work with the y dimension as the first dimension zzz transpose temporary zzz extend jpj to be a multiple of 8 jpjadd jpj_m 8 jpj IF jpjadd NE 0 THEN zzz temporary zzz bytarr jpjadd jpi reform zzz to look like output of binary pro zzz reform zzz 8 1 jpj_m jpi over convert into its byte form zzz inverse_binary temporary zzz ncdf_varput cdfidout msklist m transpose temporary zzz offset 0 0 k count jpi jpj_m 1 ENDFOR ENDFOR ncdf_close cdfid ncdf_close cdfidout RETURN END"); 39 39 a[37] = new Array("./Grid/n128gaussian.html", "n128gaussian.pro", "", " file_comments compute the latitudes of the n128 gaussian grid See: http: www ecmwf int products data technical gaussian n128FIS html categories Grid examples IDL lat n128gaussian returns a 1d array history Sebastien Masson smasson lodyc jussieu fr June 2004 version Id: n128gaussian pro 157 2006 08 21 09:01:50Z navarro FUNCTION n128gaussian compile_opt idl2 strictarrsubs latitude reduced regular latitude number points points n128 1 18 512 89 46282 2 25 512 88 76695 3 36 512 88 06697 4 40 512 87 36606 5 45 512 86 66480 6 50 512 85 96337 7 60 512 85 26184 8 64 512 84 56026 9 72 512 83 85863 10 72 512 83 15698 11 80 512 82 45531 12 90 512 81 75363 13 90 512 81 05194 14 100 512 80 35023 15 108 512 79 64852 16 120 512 78 94681 17 120 512 78 24509 18 125 512 77 54336 19 128 512 76 84163 20 144 512 76 13990 21 144 512 75 43817 22 150 512 74 73644 23 160 512 74 03470 24 160 512 73 33296 25 180 512 72 63123 26 180 512 71 92949 27 180 512 71 22774 28 192 512 70 52600 29 192 512 69 82426 30 200 512 69 12252 31 216 512 68 42077 32 216 512 67 71903 33 216 512 67 01728 34 225 512 66 31554 35 240 512 65 61379 36 240 512 64 91204 37 240 512 64 21030 38 250 512 63 50855 39 250 512 62 80680 40 256 512 62 10505 41 270 512 61 40330 42 270 512 60 70156 43 288 512 59 99981 44 288 512 59 29806 45 288 512 58 59631 46 300 512 57 89456 47 300 512 57 19281 48 320 512 56 49106 49 320 512 55 78931 50 320 512 55 08756 51 320 512 54 38581 52 324 512 53 68406 53 360 512 52 98231 54 360 512 52 28056 55 360 512 51 57881 56 360 512 50 87705 57 360 512 50 17530 58 360 512 49 47355 59 360 512 48 77180 60 375 512 48 07005 61 375 512 47 36830 62 375 512 46 66655 63 375 512 45 96479 64 384 512 45 26304 65 384 512 44 56129 66 400 512 43 85954 67 400 512 43 15779 68 400 512 42 45604 69 400 512 41 75428 70 405 512 41 05253 71 432 512 40 35078 72 432 512 39 64903 73 432 512 38 94728 74 432 512 38 24552 75 432 512 37 54377 76 432 512 36 84202 77 432 512 36 14027 78 450 512 35 43851 79 450 512 34 73676 80 450 512 34 03501 n128 n128 81 450 512 33 33326 82 450 512 32 63150 83 480 512 31 92975 84 480 512 31 22800 85 480 512 30 52625 86 480 512 29 82449 87 480 512 29 12274 88 480 512 28 42099 89 480 512 27 71924 90 480 512 27 01748 91 480 512 26 31573 92 480 512 25 61398 93 486 512 24 91223 94 486 512 24 21047 95 486 512 23 50872 96 500 512 22 80697 97 500 512 22 10521 98 500 512 21 40346 99 500 512 20 70171 100 500 512 19 99996 101 500 512 19 29820 102 500 512 18 59645 103 512 512 17 89470 104 512 512 17 19294 105 512 512 16 49119 106 512 512 15 78944 107 512 512 15 08768 108 512 512 14 38593 109 512 512 13 68418 110 512 512 12 98243 111 512 512 12 28067 112 512 512 11 57892 113 512 512 10 87717 114 512 512 10 17541 115 512 512 9 47366 116 512 512 8 77191 117 512 512 8 07016 118 512 512 7 36840 119 512 512 6 66665 120 512 512 5 96490 121 512 512 5 26314 122 512 512 4 56139 123 512 512 3 85964 124 512 512 3 15788 125 512 512 2 45613 126 512 512 1 75438 127 512 512 1 05262 128 512 512 0 35087 n128 reform n128 4 128 over n128 reform n128 3 over n128 n128 reverse n128 return n128 end"); … … 52 52 a[50] = new Array("./Interpolation/clickincell.html", "clickincell.pro", "", " file_comments click on a map and find in which cell the click was categories Grid keyword CELLTYPE T W U V or F This this the type of point that is located in the center of the cell which the click is located default is T type of cell with corner defined by F points keyword DRAWCELL to draw the cell in which we clicked keyword COLOR the color used to draw the cells Clicking one more time in the same cell will draw the cell with the white color keyword ORIGINAL to get the position of the cell regarding the original grid with no key_shift ixminmesh iyminmesh keyword IJ see outputs keyword _EXTRA to pass extra keywords to inquad and plot when drawcell returns the index of the selected cells regarding to the grid which is in memory in the variable of the common If ij keyword is activated give 2D array 2 n which are the i j position of the n selected cells uses common pro examples IDL res clickincell Click with the left button to select a cell Clicking one more time in the same cell remove the cell from the selection Click on the right button to quit IDL plt findgen jpi jpj nodata map 90 0 0 ortho IDL print clickincell draw color 150 xy history Sebastien Masson smasson lodyc jussieu fr August 2003 version Id: clickincell pro 163 2006 08 29 12:59:46Z navarro FUNCTION clickincell CELLTYPE celltype DRAWCELL drawcell COLOR color ORIGINAL original IJ ij _EXTRA extra compile_opt idl2 strictarrsubs common initialization cellnum 1L selected 0 Cell list get the grid parameter according to celltype oldgrid vargrid IF NOT keyword_set celltype THEN celltype T CASE strupcase celltype OF T :vargrid F W :vargrid F U :vargrid V V :vargrid U F :vargrid T ENDCASE grille 1 glam gphi 1 nx ny nz firstx firsty firstz lastx lasty lastz vargrid oldgrid define the corner of the cells in the clockwise direction IF keyword_set key_periodic AND nx EQ jpi THEN BEGIN x1 glam 0:ny 2 y1 gphi 0:ny 2 x2 glam 1:ny 1 y2 gphi 1:ny 1 x3 shift glam 1:ny 1 1 0 y3 shift gphi 1:ny 1 1 0 x4 shift glam 0:ny 2 1 0 y4 shift gphi 0:ny 2 1 0 ENDIF ELSE BEGIN x1 glam 0:nx 2 0:ny 2 y1 gphi 0:nx 2 0:ny 2 x2 glam 0:nx 2 1:ny 1 y2 gphi 0:nx 2 1:ny 1 x3 glam 1:nx 1 1:ny 1 y3 gphi 1:nx 1 1:ny 1 x4 glam 1:nx 1 0:ny 2 y4 gphi 1:nx 1 0:ny 2 ENDELSE glam 1 free memory gphi 1 free memory get mousse position on the reference map cursor x y data up while mouse button ne 4 do BEGIN IF finite x finite x EQ 0 THEN GOTO outwhile case mouse button of 1:BEGIN What is the longitude WHILE x GT x range 1 DO x x 360 WHILE x LT x range 0 DO x x 360 IF x GT x range 1 THEN GOTO outwhile IF y GT y range 1 THEN GOTO outwhile IF y LT y range 0 THEN GOTO outwhile cell inquad x y x1 y1 x2 y2 x3 y3 x4 y4 onsphere _extra extra IF cell 0 EQ 1 OR n_elements cell GT 1 THEN GOTO outwhile cell cell 0 already where cellnum EQ cell 0 IF already EQ 1 THEN BEGIN cellnum cellnum cell selected selected 1 already n_elements selected 1 ENDIF ELSE selected already 1 selected already IF keyword_set drawcell THEN BEGIN oplot x1 cell x2 cell x3 cell x4 cell x1 cell y1 cell y2 cell y3 cell y4 cell y1 cell color color selected already d n_colors 255 1 selected already _extra extra ENDIF END 2: middle button ELSE: ENDCASE get mousse position on the reference map outwhile: cursor x y data up ENDWHILE good where selected NE 0 IF good 0 EQ 1 THEN RETURN 1 cellnum cellnum good yy cellnum nx 1 key_periodic nx EQ jpi xx cellnum MOD nx 1 key_periodic nx EQ jpi CASE strupcase celltype OF T :BEGIN xx xx firstx 1 yy yy firsty 1 END W :BEGIN xx xx firstx 1 yy yy firsty 1 END U :BEGIN xx xx firstx yy yy firsty 1 END V :BEGIN xx xx firstx 1 yy yy firsty END F :BEGIN xx xx firstx yy yy firsty END ENDCASE bad where xx GE jpi IF bad 0 NE 1 THEN BEGIN xx bad xx bad jpi yy bad yy bad 1 ENDIF bad where yy GE jpj IF bad 0 NE 1 THEN stop IF keyword_set original THEN BEGIN xx xx key_shift bad where xx LT 0 IF bad 0 NE 1 THEN xx bad xx bad jpi xx xx MOD jpi xx xx ixminmesh yy yy iyminmesh ENDIF ncell n_elements xx IF keyword_set ij THEN RETURN reform xx 1 ncell over reform yy 1 ncell over IF keyword_set original THEN RETURN xx jpiglo yy ELSE RETURN xx jpi yy END"); 53 53 a[51] = new Array("./Interpolation/compute_fromirr_bilinear_weigaddr.html", "compute_fromirr_bilinear_weigaddr.pro", "", " file_comments compute the weight and address needed to interpolate data from an irregular 2D grid defined as a grid made of quadrilateral cells to any grid using the bilinear method categories Interpolation param olonin in required type 2d array longitude of the input data param olat in required type 2d array latitude of the input data param omsk in required type 2d array or 1 land sea mask of the input data put 1 if input data are not masked param alonin in required type 2d array longitude of the output data param alat in required type 2d array latitude of the output data param amsk in required type 2d array or 1 land sea mask of the output data put 1 if output data are not masked param weig out type 2d array see ADDR param addr out type 2d array 2D arrays weig and addr are the weight and addresses used to perform the interpolation: dataout total weig datain addr 1 dataout reform dataout jpia jpja over restrictions the input grid must be an irregular 2D grid defined as a grid made of quadrilateral cells which corners positions are defined with olonin and olat We supposed the data are located on a sphere with a periodicity along the longitude to perform the bilinear interpolation within quadrilateral cells we first morph the cell into a square cell and then compute the bilinear interpolation if some corners of the cell are land points their weight is set to 0 and the weight is redistributed on the remaining water corners points located out of the southern and northern boundaries or in cells containing only land points are set the the same value as their closest neighbor history June 2006: Sebastien Masson smasson lodyc jussieu fr version Id: compute_fromirr_bilinear_weigaddr pro 202 2007 01 12 11:00:06Z smasson PRO compute_fromirr_bilinear_weigaddr olonin olat omsk alonin alat amsk weig addr compile_opt idl2 strictarrsubs jpia size alonin dimensions 0 jpja size alonin dimensions 1 jpio size olonin dimensions 0 jpjo size olonin dimensions 1 mask check IF n_elements omsk EQ 1 AND omsk 0 EQ 1 THEN omsk replicate 1b jpio jpjo IF n_elements amsk EQ 1 AND amsk 0 EQ 1 THEN amsk replicate 1b jpia jpja IF n_elements omsk NE jpio jpjo THEN BEGIN print input grid mask do not have the good size stop ENDIF IF n_elements amsk NE jpia jpja THEN BEGIN print output grid mask do not have the good size stop ENDIF longitude between 0 and 360 alon alonin MOD 360 out where alon LT 0 IF out 0 NE 1 THEN alon out alon out 360 olon olonin MOD 360 out where olon LT 0 IF out 0 NE 1 THEN olon out olon out 360 we work only on the ouput grid water points awater where amsk EQ 1 nawater n_elements awater define all cells that have corners located at olon olat we define the cell with the address of all corners 3 2 0 1 alladdr lindgen jpio jpjo 1 celladdr lonarr 4 jpio jpjo 1 celladdr 0 alladdr celladdr 1 shift alladdr 1 celladdr 2 shift alladdr jpio 1 celladdr 3 alladdr jpio list the cells that have at least 1 ocean point as corner good where total omsk celladdr 1 GT 0 keep only those cells celladdr celladdr temporary good xcell olon celladdr minxcell min xcell dimension 1 max maxxcell ycell olat celladdr minycell min ycell dimension 1 max maxycell foraddr: address of the ocean water cell associated to each atmosphere water point foraddr lonarr nawater forweight: x y position of the atmosphere water point in the ocean water cell forweight dblarr nawater 2 Loop on all the water point of the atmosphere We look for which ocean water cell contains the atmosphere water point delta max 360 jpio 180 jpjo 4 FOR n 0L nawater 1 DO BEGIN control print IF n MOD 5000 EQ 0 THEN print n longitude and latitude of the atmosphere water point xx alon awater n yy alat awater n 1 we reduce the number of ocean cells for which we will try to know if xx yy is inside CASE 1 OF if we are near the norh pole yy GE 90 delta :BEGIN lat1 90 2 delta good where maxycell GE lat1 onsphere 1 END if we are near the longitude periodicity area xx LE delta OR xx GE 360 delta :BEGIN lat1 yy delta lat2 yy delta good where minxcell LE 2 delta OR maxxcell GE 360 2 delta AND maxycell GE lat1 AND minycell LE lat2 onsphere 1 END other cases ELSE:BEGIN lon1 xx delta lon2 xx delta lat1 yy delta lat2 yy delta good where maxxcell GE lon1 AND minxcell LE lon2 AND maxycell GE lat1 AND minycell le lat2 ORCA cases : orca grid is irregular only northward of 40N CASE 1 OF jpio EQ 92 AND jpjo EQ 76 OR jpjo EQ 75 OR jpjo EQ 74 :onsphere yy GT 40 jpio EQ 180 AND jpjo EQ 149 OR jpjo EQ 148 OR jpjo EQ 147 :onsphere yy GT 40 jpio EQ 720 AND jpjo EQ 522 OR jpjo EQ 521 OR jpjo EQ 520 :onsphere yy GT 40 jpio EQ 1440 AND jpjo EQ 1021 OR jpjo EQ 1020 OR jpjo EQ 1019 :onsphere yy GT 40 ELSE:onsphere 1 ENDCASE END ENDCASE we found a short list of possible ocean water cells containing the atmosphere water point IF good 0 NE 1 THEN BEGIN in which cell is located the atmosphere water point Warning inquad use clockwise quadrilateral definition ind inquad xx yy xcell 0 good ycell 0 good xcell 3 good ycell 3 good xcell 2 good ycell 2 good xcell 1 good ycell 1 good onsphere onsphere newcoord newcoord noprint keep only the first cell if the atmospheric point was located in several ocean cells ind ind 0 we found one ocean water cell containing the atmosphere water point IF ind NE 1 THEN BEGIN ind good ind now we morph the quadrilateral ocean cell into the reference square 0 1 in addition we get the corrdinates of the atmospheric point in this new morphed square IF onsphere THEN BEGIN Warning quadrilateral2square use anticlockwise quadrilateral definition xy quadrilateral2square newcoord 0 0 newcoord 1 0 newcoord 0 3 newcoord 1 3 newcoord 0 2 newcoord 1 2 newcoord 0 1 newcoord 1 1 newcoord 0 4 newcoord 1 4 ENDIF ELSE BEGIN xy quadrilateral2square xcell 0 ind ycell 0 ind xcell 1 ind ycell 1 ind xcell 2 ind ycell 2 ind xcell 3 ind ycell 3 ind xx yy ENDELSE take care of rounding errors zero where abs xy LT 1e 4 IF zero 0 NE 1 THEN xy zero 0 one where abs 1 xy LT 1e 4 IF one 0 NE 1 THEN xy one 1 some checks tmpmsk omsk celladdr ind CASE 1 OF xy 0 LT 0 OR xy 0 GT 1 : stop xy 1 LT 0 OR xy 1 GT 1 : stop xy 0 EQ 0 AND xy 1 EQ 0 AND tmpmsk 0 EQ 0 : foraddr n 1 xy 0 EQ 1 AND xy 1 EQ 0 AND tmpmsk 1 EQ 0 : foraddr n 1 xy 0 EQ 1 AND xy 1 EQ 1 AND tmpmsk 2 EQ 0 : foraddr n 1 xy 0 EQ 0 AND xy 1 EQ 1 AND tmpmsk 3 EQ 0 : foraddr n 1 xy 0 EQ 0 AND tmpmsk 0 tmpmsk 3 EQ 0 : foraddr n 1 xy 0 EQ 1 AND tmpmsk 1 tmpmsk 2 EQ 0 : foraddr n 1 xy 1 EQ 0 AND tmpmsk 0 tmpmsk 1 EQ 0 : foraddr n 1 xy 1 EQ 1 AND tmpmsk 2 tmpmsk 3 EQ 0 : foraddr n 1 ELSE: BEGIN we keep its address foraddr n ind keep the new coordinates forweight n 0 xy 0 forweight n 1 xy 1 END ENDCASE ENDIF ELSE foraddr n 1 ENDIF ELSE foraddr n 1 ENDFOR do we have some water atmospheric points that are not located in an water oceanic cell bad where foraddr EQ 1 IF bad 0 NE 1 THEN BEGIN yes we look for neighbor water atmospheric point located in water oceanic cell badaddr awater bad good where foraddr NE 1 list the atmospheric points located in water oceanic cell goodaddr awater good there longitude and latitude goodlon alon goodaddr goodlat alat goodaddr for all the bad points look for a neighbor neig lonarr n_elements bad FOR i 0 n_elements bad 1 DO BEGIN neig i neighbor alon badaddr i alat badaddr i goodlon goodlat sphere 0 ENDFOR get the address regarding foraddr neig good neig associate each bad point with its neighbor get its address and weight foraddr bad foraddr neig forweight bad forweight neig endif transform the address of the ocean cell into the address of its 4 corners newaaddr celladdr temporary foraddr now we compute the weight to give at each corner newaweig dblarr 4 nawater a reform forweight 0 1 nawater b reform forweight 1 1 nawater forweight 1 free memory newaweig 1 a 1 b 1 b a a b 1 a b a 1 b 1 free memory mask the weight to suppress the corner located on land newaweig newaweig omsk newaaddr totalweig total newaweig 1 for cell with some land corner we have to redistribute the weight on the reaining water corners weights normalization totalweig total newaweig 1 IF min totalweig max ma EQ 0 then stop IF ma GT 1 then stop newaweig newaweig replicate 1 4 totalweig totalweig total newaweig 1 weights weig dblarr 4 jpia jpja weig awater temporary newaweig address addr dblarr 4 jpia jpja addr awater temporary newaaddr RETURN END"); 54 a[52] = new Array("./Interpolation/compute_fromreg_bilinear_weigaddr.html", "compute_fromreg_bilinear_weigaddr.pro", "", " file_comments compute the weight and address needed to interpolate data from a regular grid to any grid using the bilinear method categories Interpolation param alonin in required type 2d array longitude of the input data param alatin in required type 2d array latitude of the input data param olonin in required type 2d array longitude of the output data param olat in required type 2d array latitude of the output data keyword NONORTHERNLINE type scalar 0 or 1 default 0 put 1 if you don t want to take into account the northen line of the input data when performing the interpolation keyword NOSOUTHERNLINE type scalar 0 or 1 default 0 put 1 if you don t want to take into account the southern line of the input data when performing the interpolation param weig out type 2d array see ADDR param addr out type 2d array 2D arrays weig and addr are the weight and addresses used to perform the interpolation: dataout total weig datain addr 1 dataout reform dataout jpio jpjo over restrictions the input grid must be a regular grid defined as a grid for which each longitudes lines have the same latitude and each latitudes columns have the same longitude We supposed the data are located on a sphere with a periodicity along the longitude points located out of the southern and northern boundaries are interpolated using a linear interpolation only along the longitudinal direction history November 2005: Sebastien Masson smasson lodyc jussieu fr version Id: compute_fromreg_bilinear_weigaddr pro 20 2 2007 01 12 11:00:06Z smasson PRO compute_fromreg_bilinear_weigaddr alonin alatin olonin olat weig addr NONORTHERNLINE nonorthernline NOSOUTHERNLINE nosouthernline compile_opt idl2 strictarrsubs alon alonin alat alatin olon olonin jpia n_elements alon jpja n_elements alat jpio size olon dimensions 0 jpjo size olon dimensions 1 alon minalon min alon max maxalon IF maxalon minalon GE 360 THEN stop alon must be monotonically increasing IF array_equal sort alon lindgen jpia NE 1 THEN BEGIN shiftx where alon EQ min alon 0 alon shift alon shiftx IF array_equal sort alon lindgen jpia NE 1 THEN stop ENDIF ELSE shiftx 0 for longitude periodic boundary condition we add the fist column on the right side of the array and alon alon alon 0 360 jpia jpia 1L alat revy alat 0 GT alat 1 IF revy THEN alat reverse alat alat must be monotonically increasing IF array_equal sort alat lindgen jpja NE 1 THEN stop if keyword_set nonorthernline then BEGIN jpja jpja 1L alat alat 0: jpja 1L ENDIF if keyword_set nosouthernline then BEGIN alat alat 1: jpja 1L jpja jpja 1L ENDIF olon between minalon et minalon 360 out where olon LT minalon WHILE out 0 NE 1 DO BEGIN olon out olon out 360 out where olon LT minalon ENDWHILE out where olon GE minalon 360 WHILE out 0 NE 1 DO BEGIN olon out olon out 360 out where olon GE minalon 360 ENDWHILE make sure that all values of olon are located within values of alon IF min olon max ma LT minalon THEN stop IF ma GE minalon 360 THEN stop we want to do biliear interpolation for each ocean point we must find in which atm cell it is located if the ocean point is out of the atm grid we use closest neighbor interpolation for each T point of oce grid we find in which armospheric cell it is located As the atmospheric grid is regular we can use inrecgrid instead of inquad pos inrecgrid olon olat alon 0:jpia 2L alat 0:jpja 2L checkout alon jpia 1L alat jpja 1L output2d checks for longitude each ocean points must be located in atm cell IF where pos 0 EQ 1 0 NE 1 THEN stop no ocean point should be located westward of the left boundary of the atm cell in which it is supposed to be located IF total olon LT alon pos 0 NE 0 THEN stop no ocean point should be located eastward of the right boundary of the atm cell in which it is supposed to be located IF total olon GT alon pos 0 1 NE 0 THEN stop we use bilinear interpolation we change the coordinates of each ocean points to fit into a rectangle defined by: y2 y1 x1 x2 X x x1 x2 x1 Y y y1 y2 y1 indx pos 0 indy temporary pos 1 points located out of the atmospheric grid too much northward or southward bad where indy EQ 1 indy 0 indy IF max indx GT jpia 2 THEN stop checks IF max indy GT jpja 2 THEN stop checks x coordinates of the atm cell x1 alon indx x2 alon indx 1 new x coordinates of the ocean points in each cell divi temporary x2 x1 glamnew olon x1 temporary divi x1 1 free memory olon 1 free memory y coordinates of the atm cell y1 alat indy y2 alat indy 1 new y coordinates of the ocean points in each cell divi temporary y2 y1 zero where divi EQ 0 IF zero 0 NE 1 THEN divi zero 1 gphinew olat y1 temporary divi y1 1 free memory checks IF min glamnew LT 0 THEN stop IF max glamnew GT 1 THEN stop weight and address array used for bilinear interpolation xaddr lonarr 4 jpio jpjo xaddr 0 indx xaddr 1 indx 1L xaddr 2 indx 1L xaddr 3 indx yaddr lonarr 4 jpio jpjo yaddr 0 indy yaddr 1 indy yaddr 2 indy 1L yaddr 3 indy 1L compute the weight for the bilinear interpolation weig fltarr 4 jpio jpjo weig 0 1 glamnew 1 gphinew weig 1 glamnew 1 gphinew weig 2 glamnew gphinew weig 3 1 glamnew gphinew free memory gphinew 1 IF bad 0 EQ 1 THEN glamnew 1 ELSE glamnew temporary glamnew bad we work now on the bad points linear interpolation only along the longitudinal direction IF bad 0 NE 1 THEN BEGIN ybad olat bad the ocean points that are not located into an atm cell should be located northward of the northern boundary of the atm grid or southward of the southern boundary of the atm grid IF total ybad GE min alat AND ybad LE max alat GE 1 THEN stop weig 0 bad 1 glamnew weig 1 bad temporary glamnew weig 2 bad 0 weig 3 bad 0 south where ybad LT alat 0 IF south 0 NE 1 THEN yaddr bad temporary south 0L north where ybad GT alat jpja 1 IF north 0 NE 1 THEN yaddr bad temporary north 0Lybad 1 bad 1 free memory ENDIF check totalweight 1 totalweig abs 1 total weig 1 IF where temporary totalweig GE 1 e 5 0 NE 1 THEN stop come back to the original atm grid without longitudinal overlap jpia jpia 1L xaddr temporary xaddr MOD jpia take into account shiftx if needed IF shiftx NE 0 THEN xaddr temporary xaddr shiftx MOD jpia take into account nosouthernline and nonorthernline if keyword_set nosouthernline then BEGIN yaddr temporary yaddr 1L jpja jpja 1L ENDIF if keyword_set nonorthernline then jpja jpja 1L take into account revy if needed IF revy EQ 1 THEN yaddr jpja 1L temporary yaddr addr temporary yaddr jpia temporary xaddr return end ");54 a[52] = new Array("./Interpolation/compute_fromreg_bilinear_weigaddr.html", "compute_fromreg_bilinear_weigaddr.pro", "", " file_comments compute the weight and address needed to interpolate data from a regular grid to any grid using the bilinear method categories Interpolation param alonin in required type 2d array longitude of the input data param alatin in required type 2d array latitude of the input data param olonin in required type 2d array longitude of the output data param olat in required type 2d array latitude of the output data keyword NONORTHERNLINE type scalar 0 or 1 default 0 put 1 if you don t want to take into account the northen line of the input data when performing the interpolation keyword NOSOUTHERNLINE type scalar 0 or 1 default 0 put 1 if you don t want to take into account the southern line of the input data when performing the interpolation param weig out type 2d array see ADDR param addr out type 2d array 2D arrays weig and addr are the weight and addresses used to perform the interpolation: dataout total weig datain addr 1 dataout reform dataout jpio jpjo over restrictions the input grid must be a regular grid defined as a grid for which each longitudes lines have the same latitude and each latitudes columns have the same longitude We supposed the data are located on a sphere with a periodicity along the longitude points located out of the southern and northern boundaries are interpolated using a linear interpolation only along the longitudinal direction history November 2005: Sebastien Masson smasson lodyc jussieu fr version Id: compute_fromreg_bilinear_weigaddr pro 208 2007 02 02 11:23:09Z smasson PRO compute_fromreg_bilinear_weigaddr alonin alatin olonin olat weig addr NONORTHERNLINE nonorthernline NOSOUTHERNLINE nosouthernline compile_opt idl2 strictarrsubs alon alonin alat alatin olon olonin jpia n_elements alon jpja n_elements alat jpio size olon dimensions 0 jpjo size olon dimensions 1 alon minalon min alon max maxalon IF maxalon minalon GE 360 THEN stop alon must be monotonically increasing IF array_equal sort alon lindgen jpia NE 1 THEN BEGIN shiftx where alon EQ min alon 0 alon shift alon shiftx IF array_equal sort alon lindgen jpia NE 1 THEN stop ENDIF ELSE shiftx 0 for longitude periodic boundary condition we add the fist column on the right side of the array and alon alon alon 0 360 jpia jpia 1L alat revy alat 0 GT alat 1 IF revy THEN alat reverse alat alat must be monotonically increasing IF array_equal sort alat lindgen jpja NE 1 THEN stop if keyword_set nonorthernline then BEGIN jpja jpja 1L alat alat 0: jpja 1L ENDIF if keyword_set nosouthernline then BEGIN alat alat 1: jpja 1L jpja jpja 1L ENDIF olon between minalon et minalon 360 out where olon LT minalon WHILE out 0 NE 1 DO BEGIN olon out olon out 360 out where olon LT minalon ENDWHILE out where olon GE minalon 360 WHILE out 0 NE 1 DO BEGIN olon out olon out 360 out where olon GE minalon 360 ENDWHILE make sure that all values of olon are located within values of alon IF min olon max ma LT minalon THEN stop IF ma GE minalon 360 THEN stop we want to do biliear interpolation for each ocean point we must find in which atm cell it is located if the ocean point is out of the atm grid we use closest neighbor interpolation for each T point of oce grid we find in which armospheric cell it is located As the atmospheric grid is regular we can use inrecgrid instead of inquad pos inrecgrid olon olat alon 0:jpia 2L alat 0:jpja 2L checkout alon jpia 1L alat jpja 1L output2d checks for longitude each ocean points must be located in atm cell IF where pos 0 EQ 1 0 NE 1 THEN stop no ocean point should be located westward of the left boundary of the atm cell in which it is supposed to be located IF total olon LT alon pos 0 NE 0 THEN stop no ocean point should be located eastward of the right boundary of the atm cell in which it is supposed to be located IF total olon GT alon pos 0 1 NE 0 THEN stop we use bilinear interpolation we change the coordinates of each ocean points to fit into a rectangle defined by: y2 y1 x1 x2 X x x1 x2 x1 Y y y1 y2 y1 indx pos 0 indy temporary pos 1 points located out of the atmospheric grid too much northward or southward bad where indy EQ 1 indy 0 indy IF max indx GT jpia 2 THEN stop checks IF max indy GT jpja 2 THEN stop checks x coordinates of the atm cell x1 alon indx x2 alon indx 1 new x coordinates of the ocean points in each cell divi temporary x2 x1 glamnew olon x1 temporary divi x1 1 free memory olon 1 free memory y coordinates of the atm cell y1 alat indy y2 alat indy 1 new y coordinates of the ocean points in each cell divi temporary y2 y1 zero where divi EQ 0 IF zero 0 NE 1 THEN divi zero 1 gphinew olat y1 temporary divi y1 1 free memory checks IF min glamnew LT 0 THEN stop IF max glamnew GT 1 THEN stop weight and address array used for bilinear interpolation xaddr lonarr 4 jpio jpjo xaddr 0 indx xaddr 1 indx 1L xaddr 2 indx 1L xaddr 3 indx yaddr lonarr 4 jpio jpjo yaddr 0 indy yaddr 1 indy yaddr 2 indy 1L yaddr 3 indy 1L compute the weight for the bilinear interpolation weig fltarr 4 jpio jpjo weig 0 1 glamnew 1 gphinew weig 1 glamnew 1 gphinew weig 2 glamnew gphinew weig 3 1 glamnew gphinew free memory gphinew 1 IF bad 0 EQ 1 THEN glamnew 1 ELSE glamnew temporary glamnew bad we work now on the bad points linear interpolation only along the longitudinal direction IF bad 0 NE 1 THEN BEGIN ybad olat bad the ocean points that are not located into an atm cell should be located northward of the northern boundary of the atm grid or southward of the southern boundary of the atm grid IF total ybad GE min alat AND ybad LE max alat GE 1 THEN stop weig 0 bad 1 glamnew weig 1 bad temporary glamnew weig 2 bad 0 weig 3 bad 0 south where ybad LT alat 0 IF south 0 NE 1 THEN yaddr bad temporary south 0L north where ybad GT alat jpja 1 IF north 0 NE 1 THEN yaddr bad temporary north jpja 1 ybad 1 bad 1 free memory ENDIF check totalweight 1 totalweig abs 1 total weig 1 IF where temporary totalweig GE 1 e 5 0 NE 1 THEN stop come back to the original atm grid without longitudinal overlap jpia jpia 1L xaddr temporary xaddr MOD jpia take into account shiftx if needed IF shiftx NE 0 THEN xaddr temporary xaddr shiftx MOD jpia take into account nosouthernline and nonorthernline if keyword_set nosouthernline then BEGIN yaddr temporary yaddr 1L jpja jpja 1L ENDIF if keyword_set nonorthernline then jpja jpja 1L take into account revy if needed IF revy EQ 1 THEN yaddr jpja 1L temporary yaddr addr temporary yaddr jpia temporary xaddr return end "); 55 55 a[53] = new Array("./Interpolation/compute_fromreg_imoms3_weigaddr.html", "compute_fromreg_imoms3_weigaddr.pro", "", " file_comments compute the weight and address need to interpolate data from a regular grid to any grid using the imoms3 method categories Interpolation param alonin in required type 2d array longitude of the input data param alatin in required type 2d array latitude of the input data param olonin in required type 2d array longitude of the output data param olat in required type 2d array latitude of the output data keyword NONORTHERNLINE type scalar 0 or 1 default 0 put 1 if you don t want to take into account the northen line of the input data when performing the interpolation keyword NOSOUTHERNLINE type scalar 0 or 1 default 0 put 1 if you don t want to take into account the southern line of the input data when performing the interpolation param weig out type 2d array see ADDR param addr out type 2d array 2D arrays weig and addr are the weight and addresses used to perform the interpolation: dataout total weig datain addr 1 dataout reform dataout jpio jpjo over restrictions the input grid must be a regular rectangular grid defined as a grid for which each longitudes lines have the same latitude and each latitudes columns have the same longitude We supposed the data are located on a sphere with a periodicity along the longitude points located between the first last 2 lines are interpolated using a imoms3 interpolation along the longitudinal direction and linear interpolation along the latitudinal direction points located out of the southern and northern boundaries are interpolated using a imoms3 interpolation only along the longitudinal direction history November 2005: Sebastien Masson smasson lodyc jussieu fr March 2006: works for rectangular grids version Id: compute_fromreg_imoms3_weigaddr pro 202 2007 01 12 11:00:06Z smasson PRO compute_fromreg_imoms3_weigaddr alonin alatin olonin olat weig addr NONORTHERNLINE nonorthernline NOSOUTHERNLINE nosouthernline compile_opt idl2 strictarrsubs alon alonin alat alatin olon olonin jpia n_elements alon jpja n_elements alat jpio size olon dimensions 0 jpjo size olon dimensions 1 alon minalon min alon max maxalon IF maxalon minalon GE 360 THEN stop alon must be monotonically increasing IF array_equal sort alon lindgen jpia NE 1 THEN BEGIN shiftx where alon EQ min alon 0 alon shift alon shiftx IF array_equal sort alon lindgen jpia NE 1 THEN stop ENDIF ELSE shiftx 0 alon is it regularly spaced step alon shift alon 1 step 0 step 0 360 IF total step step 0 GE 1 e 6 NE 0 THEN noregx 1 we extend the longitude range of alon easy interpolation even near minalon et maxalon toadd 10 jpia 360 1 alon alon jpia toadd:jpia 1 360 alon alon 0:toadd 1 360 jpia jpia 2 toadd alat revy alat 0 GT alat 1 IF revy THEN alat reverse alat alat must be monotonically increasing IF array_equal sort alat lindgen jpja NE 1 THEN stop alat is it regularly spaced step alat shift alat 1 step step 1:jpja 1L IF total step step 0 GE 1 e 6 NE 0 THEN noregy 1 if keyword_set nonorthernline then BEGIN jpja jpja 1L alat alat 0: jpja 1L ENDIF if keyword_set nosouthernline then BEGIN alat alat 1: jpja 1L jpja jpja 1L ENDIF olon between minalon et minalon 360 out where olon LT minalon WHILE out 0 NE 1 DO BEGIN olon out olon out 360 out where olon LT minalon ENDWHILE out where olon GE minalon 360 WHILE out 0 NE 1 DO BEGIN olon out olon out 360 out where olon GE minalon 360 ENDWHILE make sure that all values of olon are located within values of alon IF min olon max ma LT minalon THEN stop IF ma GE minalon 360 THEN stop xaddr lonarr 16 jpio jpjo yaddr lonarr 16 jpio jpjo weig fltarr 16 jpio jpjo indexlon value_locate alon olon IF total alon indexlon GT olon NE 0 THEN stop IF total alon indexlon 1L LE olon NE 0 THEN stop IF where indexlon LE 1L 0 NE 1 THEN stop IF where indexlon GE jpia 3L 0 NE 1 THEN stop indexlat value_locate alat olat for the ocean points located below the atm line jpja 2 and above the line 1 for those points we can always find 16 neighbors imoms interpolation along longitude and latitude short where indexlat LT jpja 2L AND indexlat GE 1L ilon indexlon short ilat indexlat short IF NOT keyword_set noregy THEN BEGIN delta alat ilat 1L alat ilat IF max abs delta delta 0 GE 1 e 6 THEN stop delta delta 0 d0 alat ilat 1L olat short delta IF min d0 max ma LE 2 THEN stop IF ma GT 1 THEN stop wy0 imoms3 temporary d0 d1 alat ilat olat short delta IF min d1 max ma LE 1 THEN stop IF ma GT 0 THEN stop wy1 imoms3 temporary d1 d2 alat ilat 1L olat short delta IF min d2 max ma LE 0 THEN stop IF ma GT 1 THEN stop wy2 imoms3 temporary d2 d3 alat ilat 2L olat short delta IF min d3 max ma LE 1 THEN stop IF ma GT 2 THEN stop wy3 imoms3 temporary d3 ENDIF ELSE BEGIN nele n_elements short wy0 fltarr nele wy1 fltarr nele wy2 fltarr nele wy3 fltarr nele FOR i 0L nele 1 DO BEGIN IF i MOD 10000 EQ 0 THEN print i newlat spl_incr alat ilat i 1L:ilat i 2L 1 0 1 2 olat short i IF newlat LE 0 THEN stop IF newlat GT 1 THEN stop wy0 i imoms3 newlat 1 wy1 i imoms3 newlat wy2 i imoms3 1 newlat wy3 i imoms3 2 newlat ENDFOR ENDELSE mi min wy0 wy1 wy2 wy3 max ma IF abs mi 1 GE 1 e 6 THEN stop IF abs ma 1 GE 1 e 6 THEN stop IF NOT keyword_set noregx THEN BEGIN delta alon ilon alon ilon 1L IF max abs delta delta 0 GE 1 e 6 THEN stop delta delta 0 d0 alon ilon 1L olon short delta IF min d0 max ma LE 2 THEN stop IF ma GT 1 THEN stop wx0 imoms3 temporary d0 d1 alon ilon olon short delta IF min d1 max ma LE 1 THEN stop IF ma GT 0 THEN stop wx1 imoms3 temporary d1 d2 alon ilon 1L olon short delta IF min d2 max ma LE 0 THEN stop IF ma GT 1 THEN stop wx2 imoms3 temporary d2 d3 alon ilon 2L olon short delta IF min d3 max ma LE 1 THEN stop IF ma GT 2 THEN stop wx3 imoms3 temporary d3 ENDIF ELSE BEGIN nele n_elements short wx0 fltarr nele wx1 fltarr nele wx2 fltarr nele wx3 fltarr nele FOR i 0L nele 1 DO BEGIN IF i MOD 10000 EQ 0 THEN print i newlon spl_incr alon ilon i 1L:ilon i 2L 1 0 1 2 olon short i IF newlon LE 0 THEN stop IF newlon GT 1 THEN stop wx0 i imoms3 newlon 1 wx1 i imoms3 newlon wx2 i imoms3 1 newlon wx3 i imoms3 2 newlon ENDFOR ENDELSE mi min wx0 wx1 wx2 wx3 max ma IF abs mi 1 GE 1 e 6 THEN stop IF abs ma 1 GE 1 e 6 THEN stop line 0 xaddr 0 short ilon 1L xaddr 1 short ilon xaddr 2 short ilon 1L xaddr 3 short ilon 2L yaddr 0 short ilat 1L yaddr 1 short yaddr 0 short yaddr 2 short yaddr 0 short yaddr 3 short yaddr 0 short weig 0 short wx0 wy0 weig 1 short wx1 wy0 weig 2 short wx2 wy0 weig 3 short wx3 wy0 line 1 xaddr 4 short ilon 1L xaddr 5 short ilon xaddr 6 short ilon 1L xaddr 7 short ilon 2L yaddr 4 short ilat yaddr 5 short ilat yaddr 6 short ilat yaddr 7 short ilat weig 4 short wx0 wy1 weig 5 short wx1 wy1 weig 6 short wx2 wy1 weig 7 short wx3 wy1 line 2 xaddr 8 short ilon 1L xaddr 9 short ilon xaddr 10 short ilon 1L xaddr 11 short ilon 2L yaddr 8 short ilat 1L yaddr 9 short yaddr 8 short yaddr 10 short yaddr 8 short yaddr 11 short yaddr 8 short weig 8 short wx0 wy2 weig 9 short wx1 wy2 weig 10 short wx2 wy2 weig 11 short wx3 wy2 line 3 xaddr 12 short ilon 1L xaddr 13 short ilon xaddr 14 short ilon 1L xaddr 15 short ilon 2L yaddr 12 short ilat 2L yaddr 13 short yaddr 12 short yaddr 14 short yaddr 12 short yaddr 15 short yaddr 12 short weig 12 short wx0 wy3 weig 13 short wx1 wy3 weig 14 short wx2 wy3 weig 15 short wx3 wy3 mi min total weig short 1 max ma IF abs mi 1 GE 1 e 6 THEN stop IF abs ma 1 GE 1 e 6 THEN stop for the ocean points located between the atm lines jpja 2 and jpja 1 or between the atm lines 0 and 1 linear interpolation between line 1 and line 2 short where indexlat EQ jpja 2L OR indexlat EQ 0 IF short 0 NE 1 THEN BEGIN ilon indexlon short ilat indexlat short delta alat ilat 1L alat ilat IF NOT keyword_set noregy THEN BEGIN IF max abs delta delta 0 GE 1 e 6 THEN stop delta delta 0 ENDIF d1 alat ilat olat short delta IF min d1 max ma LE 1 THEN stop IF ma GT 0 THEN stop wy1 1 temporary d1 d2 alat ilat 1L olat short delta IF min d2 max ma LE 0 THEN stop IF ma GT 1 THEN stop wy2 1 temporary d2 mi min wy1 wy2 max ma IF abs mi 1 GE 1 e 6 THEN stop IF abs ma 1 GE 1 e 6 THEN stop but imoms3 along the longitude IF NOT keyword_set noregx THEN BEGIN delta alon ilon alon ilon 1L IF max abs delta delta 0 GE 1 e 6 THEN stop delta delta 0 d0 alon ilon 1L olon short delta IF min d0 max ma LE 2 THEN stop IF ma GT 1 THEN stop wx0 imoms3 temporary d0 d1 alon ilon olon short delta IF min d1 max ma LE 1 THEN stop IF ma GT 0 THEN stop wx1 imoms3 temporary d1 d2 alon ilon 1L olon short delta IF min d2 max ma LE 0 THEN stop IF ma GT 1 THEN stop wx2 imoms3 temporary d2 d3 alon ilon 2L olon short delta IF min d3 max ma LE 1 THEN stop IF ma GT 2 THEN stop wx3 imoms3 temporary d3 ENDIF ELSE BEGIN nele n_elements short wx0 fltarr nele wx1 fltarr nele wx2 fltarr nele wx3 fltarr nele FOR i 0L nele 1 DO BEGIN IF i MOD 10000 EQ 0 THEN print i newlon spl_incr alon ilon i 1L:ilon i 2L 1 0 1 2 olon short i IF newlon LE 0 THEN stop IF newlon GT 1 THEN stop wx0 i imoms3 newlon 1 wx1 i imoms3 newlon wx2 i imoms3 1 newlon wx3 i imoms3 2 newlon ENDFOR ENDELSE mi min wx0 wx1 wx2 wx3 max ma IF abs mi 1 GE 1 e 6 THEN stop IF abs ma 1 GE 1 e 6 THEN stop line 1 xaddr 0 short ilon 1L xaddr 1 short ilon xaddr 2 short ilon 1L xaddr 3 short ilon 2L yaddr 0 short ilat yaddr 1 short ilat yaddr 2 short ilat yaddr 3 short ilat weig 0 short wx0 wy1 weig 1 short wx1 wy1 weig 2 short wx2 wy1 weig 3 short wx3 wy1 line 2 xaddr 4 short ilon 1L xaddr 5 short ilon xaddr 6 short ilon 1L xaddr 7 short ilon 2L yaddr 4 short ilat 1L yaddr 5 short yaddr 4 short yaddr 6 short yaddr 4 short yaddr 7 short yaddr 4 short weig 4 short wx0 wy2 weig 5 short wx1 wy2 weig 6 short wx2 wy2 weig 7 short wx3 wy2 mi min total weig short 1 max ma IF abs mi 1 GE 1 e 6 THEN stop IF abs ma 1 GE 1 e 6 THEN stop ENDIF for the ocean points located below the line 0 Interpolation only along the longitude short where indexlat EQ 1 IF short 0 NE 1 THEN BEGIN ilon indexlon short IF NOT keyword_set noregx THEN BEGIN delta alon ilon alon ilon 1L IF max abs delta delta 0 GE 1 e 6 THEN stop delta delta 0 d0 alon ilon 1L olon short delta IF min d0 max ma LE 2 THEN stop IF ma GT 1 THEN stop wx0 imoms3 temporary d0 d1 alon ilon olon short delta IF min d1 max ma LE 1 THEN stop IF ma GT 0 THEN stop wx1 imoms3 temporary d1 d2 alon ilon 1L olon short delta IF min d2 max ma LE 0 THEN stop IF ma GT 1 THEN stop wx2 imoms3 temporary d2 d3 alon ilon 2L olon short delta IF min d3 max ma LE 1 THEN stop IF ma GT 2 THEN stop wx3 imoms3 temporary d3 ENDIF ELSE BEGIN nele n_elements short wx0 fltarr nele wx1 fltarr nele wx2 fltarr nele wx3 fltarr nele FOR i 0L nele 1 DO BEGIN IF i MOD 10000 EQ 0 THEN print i newlon spl_incr alon ilon i 1L:ilon i 2L 1 0 1 2 olon short i IF newlon LE 0 THEN stop IF newlon GT 1 THEN stop wx0 i imoms3 newlon 1 wx1 i imoms3 newlon wx2 i imoms3 1 newlon wx3 i imoms3 2 newlon ENDFOR ENDELSE mi min wx0 wx1 wx2 wx3 max ma IF abs mi 1 GE 1 e 6 THEN stop IF abs ma 1 GE 1 e 6 THEN stop line 1 xaddr 0 short ilon 1L xaddr 1 short ilon xaddr 2 short ilon 1L xaddr 3 short ilon 2L yaddr 0:3 short 0 weig 0 short wx0 weig 1 short wx1 weig 2 short wx2 weig 3 short wx3 mi min total weig short 1 max ma IF abs mi 1 GE 1 e 6 THEN stop IF abs ma 1 GE 1 e 6 THEN stop ENDIF for the ocean points located above jpia 1 Interpolation only along the longitude short where indexlat EQ jpja 1L IF short 0 NE 1 THEN BEGIN ilon indexlon short IF NOT keyword_set noregx THEN BEGIN delta alon ilon alon ilon 1L IF max abs delta delta 0 GE 1 e 6 THEN stop delta delta 0 d0 alon ilon 1L olon short delta IF min d0 max ma LE 2 THEN stop IF ma GT 1 THEN stop wx0 imoms3 temporary d0 d1 alon ilon olon short delta IF min d1 max ma LE 1 THEN stop IF ma GT 0 THEN stop wx1 imoms3 temporary d1 d2 alon ilon 1L olon short delta IF min d2 max ma LE 0 THEN stop IF ma GT 1 THEN stop wx2 imoms3 temporary d2 d3 alon ilon 2L olon short delta IF min d3 max ma LE 1 THEN stop IF ma GT 2 THEN stop wx3 imoms3 temporary d3 ENDIF ELSE BEGIN nele n_elements short wx0 fltarr nele wx1 fltarr nele wx2 fltarr nele wx3 fltarr nele FOR i 0L nele 1 DO BEGIN IF i MOD 10000 EQ 0 THEN print i newlon spl_incr alon ilon i 1L:ilon i 2L 1 0 1 2 olon short i IF newlon LE 0 THEN stop IF newlon GT 1 THEN stop wx0 i imoms3 newlon 1 wx1 i imoms3 newlon wx2 i imoms3 1 newlon wx3 i imoms3 2 newlon ENDFOR ENDELSE mi min wx0 wx1 wx2 wx3 max ma IF abs mi 1 GE 1 e 6 THEN stop IF abs ma 1 GE 1 e 6 THEN stop line 1 xaddr 0 short ilon 1L xaddr 1 short ilon xaddr 2 short ilon 1L xaddr 3 short ilon 2L yaddr 0:3 short jpja 1L weig 0 short wx0 weig 1 short wx1 weig 2 short wx2 weig 3 short wx3 mi min total weig short 1 max ma IF abs mi 1 GE 1 e 6 THEN stop IF abs ma 1 GE 1 e 6 THEN stop ENDIF Come back to the original index of atm grid without longitudinal overlap xaddr temporary xaddr toadd jpia jpia 2 toadd make sure all values are ge 0 xaddr temporary xaddr jpia range the values between 0 and jpia 1 xaddr temporary xaddr mod jpia take into account shiftx if needed IF shiftx NE 0 THEN xaddr temporary xaddr shiftx MOD jpia take into account nosouthernline and nonorthernline if keyword_set nosouthernline then BEGIN yaddr temporary yaddr 1L jpja jpja 1L ENDIF if keyword_set nonorthernline then jpja jpja 1L take into account revy if needed IF revy EQ 1 THEN yaddr jpja 1L temporary yaddr addr temporary yaddr jpia temporary xaddr RETURN END"); 56 56 a[54] = new Array("./Interpolation/cutpar.html", "cutpar.pro", "", " file_comments cut p parallelogram s into p n 2 parallelograms categories basic work param x0 in required param y0 in required param x1 in required param y1 in required param x2 in required param y2 in required param x3 in required param y3 in required 1d arrays of p elements giving the edge positions The edges must be given as in plot to draw the parallelogram see example param n in required each parallelogram will be cut in n 2 pieces keyword ENDPOINTS see outputs keyword ONSPHERE to specify that the points are located on a sphere In this case x and y corresponds to longitude and latitude in degrees returns default: a 3d array 2 n 2 p giving the center position of each piece of the parallelograms if ENDPOINTS : a 3d array 2 n 1 2 p giving the edge positions of each piece of the parallelograms uses cutsegment pro examples IDL x0 2 6 2 IDL y0 0 2 6 IDL x1 3 8 4 IDL y1 4 4 6 IDL x2 1 6 4 IDL y2 5 6 8 IDL x3 0 4 2 IDL y3 1 4 8 IDL n 4 IDL splot 0 10 0 10 xstyle 1 ystyle 1 nodata IDL for i 0 2 do oplot x0 i x1 i x2 i x3 i x0 i y0 i y1 i y2 i y3 i y0 i IDL res cutpar x0 y0 x1 y1 x2 y2 x3 y3 n IDL for i 0 2 do oplot res 0 i res 1 i color 20 10 i psym 1 thick 3 history S Masson smasson lodyc jussieu fr July 5th 2002 version Id: cutpar pro 163 2006 08 29 12:59:46Z navarro FUNCTION cutpar x0 y0 x1 y1 x2 y2 x3 y3 n ENDPOINTS endpoints ONSPHERE onsphere compile_opt idl2 strictarrsubs is it a parallelogram eps 1e 4 IF total abs x0 x2 2 x1 x3 2 GE eps GT 0 OR total abs y0 y2 2 y1 y3 2 GE eps GT 0 THEN stop print NOT a parallelogram x0 npar npar n_elements x0 firstborder 2 n keyword_set endpoints npar firstborder cutsegment x0 y0 x1 y1 n endpoints endpoints onsphere onsphere thirdborder cutsegment x3 y3 x2 y2 n endpoints endpoints onsphere onsphere res 2 n keyword_set endpoints n keyword_set endpoints npar res cutsegment firstborder 0 firstborder 1 thirdborder 0 thirdborder 1 n endpoints endpoints onsphere onsphere free memory firstborder 1 thirdborder 1 reform the result res reform res 2 n keyword_set endpoints 2 npar overwrite RETURN res END"); … … 58 58 a[56] = new Array("./Interpolation/extrapolate.html", "extrapolate.pro", "", " file_comments extrapolate data zinput where maskinput eq 0 by filling step by step the coastline points with the mean value of the 8 neighbourgs weighted by their mask value categories Interpolation param zinput in required type 2d array data to be extrapolate param maskinput in required type 2d array or 1 a 2D array the land sea mask of the output data 1 on ocean 0 on land put 1 if input data are not masked param nb_iteration in optional type integer scalar default 10 E20 Maximum number if iterations done in the extrapolation process If there is no more masked values we exit extrapolate before reaching nb_iteration to be sure to fill everything you can use a very large value keyword x_periodic type scalar 0 or 1 default 0 put 1 to specify that the data are periodic along x axis keyword MINVAL type scalar default not used to specify a minimum value to the extrapolated values keyword MAXVAL type scalar default not used to specify a maximum value to the extrapolated values keyword GE0 type scalar 0 or 1 default 0 put 1 to force the extrapolated values to be larger than 0 same as using minval 0 returns type 2d array the extrapolated array examples IDL a extrapolate dist jpi jpj tmask 0 x_periodic IDL tvplus a IDL tvplus a 1 tmask 0 get the coastline: IDL a extrapolate tmask 0 tmask 0 1 x_periodic IDL tvplus a tmask 0 history Originaly written by G Roulet Sebastien Masson smasson lodyc jussieu fr version Id: extrapolate pro 202 2007 01 12 11:00:06Z smasson FUNCTION extrapolate zinput maskinput nb_iteration x_periodic x_periodic MINVAL minval MAXVAL maxval GE0 ge0 compile_opt idl2 strictarrsubs check the number of iteration used in the extrapolation IF n_elements nb_iteration EQ 0 THEN nb_iteration 10 E20 IF nb_iteration EQ 0 THEN return zinput nx size zinput 1 ny size zinput 2 take care of the boundary conditions for the x direction we put 2 additional columns at the left and right side of the array for the y direction we put 2 additional lines at the bottom and top side of the array These changes allow us to use shift function without taking care of the x and y periodicity ztmp bytarr nx 2 ny 2 IF n_elements maskinput EQ 1 AND maskinput 0 EQ 1 THEN maskinput replicate 1b nx ny IF n_elements maskinput NE nx ny THEN BEGIN print input grid mask do not have the good size return 1 ENDIF ztmp 1:nx 1:ny byte maskinput msk temporary ztmp ztmp replicate 1 e20 nx 2 ny 2 ztmp 1:nx 1:ny zinput if keyword_set x_periodic then begin ztmp 0 1:ny zinput nx 1 ztmp nx 1 1:ny zinput 0 ENDIF remove NaN points if there is some nan where finite ztmp EQ 0 cnt_nan IF cnt_nan NE 0 THEN ztmp temporary nan 1 e20 z temporary ztmp nx2 nx 2 ny2 ny 2 extrapolation sqrtinv 1 sqrt 2 cnt 1 When we look for the coast line we don t want to select the borderlines of the array we force the value of the mask for those lines msk 0 1b msk nx 1 1b msk 0 1b msk ny 1 1b find the land points land where msk EQ 0 cnt_land WHILE cnt LE nb_iteration AND cnt_land NE 0 DO BEGIN find the coast line points Once the land points list has been found we change back the the mask values for the boundary conditions msk 0 0b msk nx 1 0b msk 0 0b msk ny 1 0b if keyword_set x_periodic then begin msk 0 msk nx msk nx 1 msk 1 endif we compute the weighted number of sea neighbourgs those 4 neighbours have a weight of 1: those 4 neighbours have a weight of 1 sqrt 2 : As we make sure that none of the land points are located on the border of the array we can compute the weight without shift faster weight msk land 1 msk land 1 msk land nx2 msk land nx2 sqrtinv msk land nx2 1 msk land nx2 1 msk land nx2 1 msk land nx2 1 list all the points that have sea neighbourgs ok where weight GT 0 the coastline points coast land ok their weighted number of sea neighbourgs weight weight temporary ok fill the coastine points z temporary z msk zcoast z 1 coast z 1 coast z nx2 coast z nx2 coast 1 sqrt 2 z nx2 1 coast z nx2 1 coast z nx2 1 coast z nx2 1 coast IF keyword_set ge0 THEN zcoast 0 temporary zcoast IF n_elements minval NE 0 THEN zcoast minval temporary zcoast IF n_elements maxval NE 0 THEN zcoast temporary zcoast we force the value of the mask for those lines msk 0 1b msk nx 1 1b msk 0 1b msk ny 1 1b find the land points land where msk EQ 0 cnt_land ENDWHILE we return the original size of the array return z 1:nx 1:ny END "); 59 59 a[57] = new Array("./Interpolation/extrapsmooth.html", "extrapsmooth.pro", "", " file_comments similar to extrapolate but could to the job in a better way because the extrapolated values are smoothed takes more time than extrapolate extrapolate data where maskinput eq 0 by filling step by step the coastline points with the mean value of the 8 neighbourgs categories Interpolation param in in required type 2d array data to be extrapolate param maskinput in required type 2d array or 1 a 2D array the land sea mask of the output data 1 on ocean 0 on land put 1 if input data are not masked keyword MINVAL type scalar default not used to specify a minimum value to the extrapolated values keyword MAXVAL type scalar default not used to specify a maximum value to the extrapolated values keyword GE0 type scalar 0 or 1 default 0 put 1 to force the extrapolated values to be larger than 0 same as using minval 0 returns the extrapolated array with no more masked values restrictions You cannot specify the number of iterations done in the extrapolation process examples IDL a extrapsmooth dist jpi jpj tmask 0 x_periodic IDL tvplus a compare to extrapolate result: IDL b extrapolate dist jpi jpj tmask 0 x_periodic IDL tvplus b window 1 history January 2007: Sebastien Masson smasson lodyc jussieu fr version Id: extrapsmooth pro 202 2007 01 12 11:00:06Z smasson FUNCTION extrapsmooth in mskin x_periodic x_periodic MINVAL minval MAXVAL maxval GE0 ge0 compile_opt strictarr strictarrsubs sz size reform in IF sz 0 NE 2 THEN BEGIN print Input arrays must have 2 dimensions return 1 ENDIF nx sz 1 ny sz 2 IF n_elements mskin EQ 1 AND mskin 0 EQ 1 THEN mskin replicate 1b nx ny IF n_elements mskin NE nx ny THEN BEGIN print input grid mask do not have the good size return 1 ENDIF out reform in whmsk where mskin EQ 0 nbr IF nbr NE 0 THEN out temporary whmsk values f_nan add values on each side of the array to avoid bondary effects nx2 nx 2 ny2 ny 2 add replicate values f_nan nx ny2 out add temporary out add IF keyword_set x_periodic THEN BEGIN add1 out 0:nx2 add2 out nx nx2:nx 1 out add2 temporary out add1 ENDIF ELSE BEGIN add replicate values f_nan nx2 ny 2 ny2 out add temporary out add ENDELSE msk0 where finite out EQ 0 nnan total finite out nan i 1 WHILE nnan NE 0 DO BEGIN tmp smooth out 2 i 1 nan find only the changed values that where on land new where finite out EQ 0 AND finite tmp EQ 1 nnew IF nnew EQ 0 then nnan 0 ELSE BEGIN IF keyword_set ge0 THEN tmp 0 temporary tmp IF n_elements minval NE 0 THEN tmp minval temporary tmp IF n_elements maxval NE 0 THEN tmp temporary tmp temporary out IF n_elements minval NE 0 THEN out minval temporary out IF n_elements maxval NE 0 THEN out temporary out maxval get back to the original domain out temporary out nx2:nx nx2 1 ny2:ny ny2 1 put back the non maskqed values whmsk where mskin NE 0 out whmsk in whmsk return out END"); 60 a[58] = new Array("./Interpolation/fromirr.html", "fromirr.pro", "", " file_comments interpolate data from an irregular 2D grid to any 2D grid Only 1 method available bilinear categories Interpolation param method in required type string a string defining the interpolation method must be bilinear param datain in required type 2d array a 2D array the input data to interpolate param lonin in optional type 2d array a 2D array defining the longitude of the input data param latin in optional type 2d array a 2D array defining the latitude of the input data param mskin in optional type 2d array or 1 a 2D array the land sea mask of the input data 1 on ocean 0 on land put 1 if input data are not masked param lonout in optional type 1d or 2d array 1D or 2D array defining the longitude of the output data param latout in optional type 1d or 2d array 1D or 2D array defining the latitude of the output data param mskout in required type 2d array or 1 a 2D array the land sea mask of the output data 1 on ocean 0 on land put 1 if output data are not masked keyword WEIG type 2d array see ADDR keyword ADDR type 2d array 2D arrays weig and addr are the weight and addresses used to perform the interpolation: dataout total weig datain addr 1 dataout reform dataout jpio jpjo over Those keywords can be set to named variables that are undefined or equal to 0 into which the values will be copied when the current routine exits Next they can be used to perform the interpolation without computing again those 2 parameters This greatly speed up the interpolation In that case lonin latin lonout and latout are not necessary returns 2D array the interpolated data restrictions We supposed the data are located on a sphere with a periodicity along the longitude Note that the input data can contain the same cells several times like ORCA grid near the north pole boundary examples IDL tncep fromirr bilinear topa glamt gphit tmask 0 lonout latout mskout or IDL t1ncep fromirr bilinear topa glamt gphit tmask 0 lonout latout mskout WEIG a ADDR b IDL help a b IDL t2ncep fromirr bilinear topa WEIG a ADDR b history June 2006: Sebastien Masson smasson lodyc jussieu fr version Id: fromirr pro 202 2007 01 12 11:00:06Z smasson FUNCTION fromirr method datain lonin latin mskin lonout latout mskout WEIG weig ADDR addr compile_opt strictarr strictarrsubs atmospheric grid parameters alon lonin alat latin get_gridparams alon alat jpia jpja 2 double Oceanic grid parameters olon lonout olat latout get_gridparams olon olat jpio jpjo 2 double Compute weight and address IF NOT keyword_set weig AND keyword_set addr THEN BEGIN CASE method OF bilinear :compute_fromirr_bilinear_weigaddr alon alat mskin olon olat mskout weig addr ELSE:BEGIN print unknown interpolation method we stop stop ENDELSE ENDCASE ENDIF to the interpolation dataout total weig datain addr 1 dataout reform dataout jpio jpjo over RETURN dataout END");61 a[59] = new Array("./Interpolation/fromreg.html", "fromreg.pro", "", " file_comments interpolate data from a regular rectangular grid to any grid 2 methods available: bilinear and imoms3 A regular rectangular grid is defined as a grid for which each longitudes lines have the same latitude and each latitudes columns have the same longitude categories Interpolation param method in required type string a string defining the interpolation method must be bilinear or imoms3 param datain in required type 2d array a 2D array the input data to interpolate param lonin in optional type 1d or 2d array 1D or 2D array defining the longitude of the input data param latin in optional type 1d or 2d array 1D or 2D array defining the latitude of the input data param lonout in optional type 1d or 2d array 1D or 2D array defining the longitude of the output data param latout in required type 1d or 2d array 1D or 2D array defining the latitude of the output data keyword WEIG type 2d array see ADDR keyword ADDR type 2d array 2D arrays weig and addr are the weight and addresses used to perform the interpolation: dataout total weig datain addr 1 dataout reform dataout jpio jpjo over Those keywords can be set to named variables that are undefined or equal to 0 into which the values will be copied when the current routine exits Next they can be used to perform the interpolation without computing again those 2 parameters In that case lonin latin lonout and latout are not necessary keyword NONORTHERNLINE activate if you don t want to take into account the northern line of the input data when performing the interpolation keyword NOSOUTHERNLINE activate if you don t want to take into account the southern line of the input data when performing the interpolation returns 2D array the interpolated data restrictions We supposed the data are located on a sphere with a periodicity along the longitude examples IDL topa fromreg bilinear tncep xncep yncep glamt gphit or IDL t1opa fromreg bilinear t1ncep xncep yncep glamt gphit WEIG a ADDR b IDL help a b IDL t2opa fromreg bilinear t2ncep xncep WEIG a ADDR b history November 2005: Sebastien Masson smasson lodyc jussieu fr version Id: fromreg pro 163 2006 08 29 12:59:46Z navarroFUNCTION fromreg method datain lonin latin lonout latout WEIG weig ADDR addr NONORTHERNLINE nonorthernline NOSOUTHERNLINE nosouthernline compile_opt idl2 strictarrsubs atmospheric grid parameters alon lonin alat latin get_gridparams alon alat jpia jpja 1 double Oceanic grid parameters olon lonout olat latout get_gridparams olon olat jpio jpjo 2 double Compute weight and address IF NOT keyword_set weig AND keyword_set addr THEN BEGIN CASE method OF bilinear :compute_fromreg_bilinear_weigaddr alon alat olon olat weig addr NONORTHERNLINE nonorthernline NOSOUTHERNLINE nosouthernline imoms3 : compute_fromreg_imoms3_weigaddr alon alat olon olat weig addr NONORTHERNLINE nonorthernline NOSOUTHERNLINE nosouthernline ELSE:BEGIN print unknown interpolation method we stop stop ENDELSE ENDCASE ENDIF dataout total weig datain addr 1 dataout reform dataout jpio jpjo over RETURN dataout END");60 a[58] = new Array("./Interpolation/fromirr.html", "fromirr.pro", "", " file_comments interpolate data from an irregular 2D grid to any 2D grid Only 1 method available bilinear categories Interpolation param method in required type string a string defining the interpolation method must be bilinear param datain in required type 2d array a 2D array the input data to interpolate param lonin in required type 2d array a 2D array defining the longitude of the input data param latin in required type 2d array a 2D array defining the latitude of the input data param mskin in required type 2d array or 1 a 2D array the land sea mask of the input data 1 on ocean 0 on land put 1 if input data are not masked param lonout in required type 1d or 2d array 1D or 2D array defining the longitude of the output data param latout in required type 1d or 2d array 1D or 2D array defining the latitude of the output data param mskout in required type 2d array or 1 a 2D array the land sea mask of the output data 1 on ocean 0 on land put 1 if output data are not masked keyword WEIG type 2d array see ADDR keyword ADDR type 2d array 2D arrays weig and addr are the weight and addresses used to perform the interpolation: dataout total weig datain addr 1 dataout reform dataout jpio jpjo over Those keywords can be set to named variables that are undefined or equal to 0 into which the values will be copied when the current routine exits Next they can be used to perform the interpolation without computing again those 2 parameters This greatly speed up the interpolation In that case lonin latin lonout and latout are not necessary returns 2D array the interpolated data restrictions We supposed the data are located on a sphere with a periodicity along the longitude Note that the input data can contain the same cells several times like ORCA grid near the north pole boundary examples IDL tncep fromirr bilinear topa glamt gphit tmask 0 lonout latout mskout or IDL t1ncep fromirr bilinear topa glamt gphit tmask 0 lonout latout mskout WEIG a ADDR b IDL help a b IDL t2ncep fromirr bilinear topa WEIG a ADDR b history June 2006: Sebastien Masson smasson lodyc jussieu fr version Id: fromirr pro 205 2007 01 22 07:55:49Z smasson FUNCTION fromirr method datain lonin latin mskin lonout latout mskout WEIG weig ADDR addr compile_opt strictarr strictarrsubs atmospheric grid parameters alon lonin alat latin get_gridparams alon alat jpia jpja 2 double Oceanic grid parameters olon lonout olat latout get_gridparams olon olat jpio jpjo 2 double Compute weight and address IF NOT keyword_set weig AND keyword_set addr THEN BEGIN CASE method OF bilinear :compute_fromirr_bilinear_weigaddr alon alat mskin olon olat mskout weig addr ELSE:BEGIN print unknown interpolation method we stop stop ENDELSE ENDCASE ENDIF to the interpolation dataout total weig datain addr 1 dataout reform dataout jpio jpjo over RETURN dataout END"); 61 a[59] = new Array("./Interpolation/fromreg.html", "fromreg.pro", "", " file_comments interpolate data from a regular rectangular grid to any grid 2 methods available: bilinear and imoms3 A regular rectangular grid is defined as a grid for which each longitudes lines have the same latitude and each latitudes columns have the same longitude categories Interpolation param method in required type string a string defining the interpolation method must be bilinear or imoms3 param datain in required type 2d array a 2D array the input data to interpolate param lonin in required type 1d or 2d array 1D or 2D array defining the longitude of the input data param latin in required type 1d or 2d array 1D or 2D array defining the latitude of the input data param lonout in required type 1d or 2d array 1D or 2D array defining the longitude of the output data param latout in required type 1d or 2d array 1D or 2D array defining the latitude of the output data keyword WEIG type 2d array see ADDR keyword ADDR type 2d array 2D arrays weig and addr are the weight and addresses used to perform the interpolation: dataout total weig datain addr 1 dataout reform dataout jpio jpjo over Those keywords can be set to named variables that are undefined or equal to 0 into which the values will be copied when the current routine exits Next they can be used to perform the interpolation without computing again those 2 parameters In that case lonin latin lonout and latout are not necessary keyword NONORTHERNLINE activate if you don t want to take into account the northern line of the input data when performing the interpolation keyword NOSOUTHERNLINE activate if you don t want to take into account the southern line of the input data when performing the interpolation returns 2D array the interpolated data restrictions We supposed the data are located on a sphere with a periodicity along the longitude examples IDL topa fromreg bilinear tncep xncep yncep glamt gphit or IDL t1opa fromreg bilinear t1ncep xncep yncep glamt gphit WEIG a ADDR b IDL help a b IDL t2opa fromreg bilinear t2ncep xncep WEIG a ADDR b history November 2005: Sebastien Masson smasson lodyc jussieu fr version Id: fromreg pro 205 2007 01 22 07:55:49Z smasson FUNCTION fromreg method datain lonin latin lonout latout WEIG weig ADDR addr NONORTHERNLINE nonorthernline NOSOUTHERNLINE nosouthernline compile_opt idl2 strictarrsubs atmospheric grid parameters alon lonin alat latin get_gridparams alon alat jpia jpja 1 double Oceanic grid parameters olon lonout olat latout get_gridparams olon olat jpio jpjo 2 double Compute weight and address IF NOT keyword_set weig AND keyword_set addr THEN BEGIN CASE method OF bilinear :compute_fromreg_bilinear_weigaddr alon alat olon olat weig addr NONORTHERNLINE nonorthernline NOSOUTHERNLINE nosouthernline imoms3 : compute_fromreg_imoms3_weigaddr alon alat olon olat weig addr NONORTHERNLINE nonorthernline NOSOUTHERNLINE nosouthernline ELSE:BEGIN print unknown interpolation method we stop stop ENDELSE ENDCASE ENDIF dataout total weig datain addr 1 dataout reform dataout jpio jpjo over RETURN dataout END"); 62 62 a[60] = new Array("./Interpolation/get_gridparams.html", "get_gridparams.pro", "", " file_comments 1 extract from a NetCDF file the longitude latitude and their dimensions and make sure it is 1D or 2D arrays or 2 given longitude and latitude arrays get their dimensions and make sure they are 1D or 2D arrays categories Interpolation examples 1 IDL get_gridparams file lonname latname lon lat jpi jpj n_dimensions or 2 IDL get_gridparams lon lat jpi jpj n_dimensions 1 param in1 in required Case 1: the name of the netcdf file Case 2: 1d or 2D arrays defining longitudes and latitudes Out: the variable that will contain the longitudes param in2 in required Case 1: the name of the variable that contains the longitude in the NetCDF file Case 2: 1d or 2D arrays defining longitudes and latitudes Note that these arrays are also outputs and can therefore be modified Out: the variable that will contain the latitudes param in3 in required Case 1: the name of the variable that contains the latitude in the NetCDF file Case 2: the number of points in the longitudinal direction param in4 out Case 1: the number of points in the longitudinal direction Case 2: the number of points in the latitudinal direction param in5 out Case 1: the number of points in the latitudinal direction Case 2: 1 or 2 to specify if lon and lat should be 1D jpi or jpj arrays or 2D arrays jpi jpj Note that of n_dimensions 1 then the grid must be regular each longitudes must be the same for all latitudes and each latitudes should be the same for all longitudes param in6 out the variable that will contain the longitudes param in7 out the variable that will contain the latitudes param in8 out 1 or 2 to specify if lon and lat should be 1D jpi or jpj keyword DOUBLE use double precision to perform the computation examples 1 IDL ncdf_get_gridparams coordinates_ORCA_R05 nc glamt gphit olon olat jpio jpjo 2 2 IDL ncdf_get_gridparams olon olat jpio jpjo 2 history November 2005: Sebastien Masson smasson lodyc jussieu fr version Id: get_gridparams pro 163 2006 08 29 12:59:46Z navarro PRO get_gridparams in1 in2 in3 in4 in5 in6 in7 in8 DOUBLE double file lonname latname lon lat jpi jpj n_dimensions lon lat jpi jpj n_dimensions compile_opt idl2 strictarrsubs CASE n_params OF 8:BEGIN get longitude and latitude IF file_test in1 EQ 0 THEN BEGIN print file in1 does not exist stop ENDIF cdfido ncdf_open in1 ncdf_varget cdfido in2 lon ncdf_varget cdfido in3 lat ncdf_close cdfido n_dimensions in8 END 5:BEGIN lon temporary in1 lat temporary in2 n_dimensions in5 END ELSE:BEGIN print Bad nimber of input parameters stop end ENDCASE sizelon size lon sizelat size lat CASE 1 OF lon and lat are 1D arrays sizelon 0 EQ 1 AND sizelat 0 EQ 1:BEGIN get jpi and jpj jpi sizelon 1 jpj sizelat 1 make sure that lon and lat have the good number of dimensions CASE n_dimensions OF 1: 2:BEGIN make lon and lat 2D arrays lon temporary lon replicate 1 jpj lat replicate 1 jpi temporary lat END ELSE:stop ENDCASE END lon is 2D array and lat is 1D array sizelon 0 EQ 2 AND sizelat 0 EQ 1:BEGIN get jpi and jpj jpi sizelon 1 jpj sizelon 2 IF jpj NE n_elements lat THEN stop make sure that lon and lat have the good number of dimensions CASE n_dimensions OF 1:BEGIN IF array_equal lon lon 0 replicate 1 jpj NE 1 THEN BEGIN print Longitudes are not the same for all latitudes imposible to extract a 1D array of the longitudes stop ENDIF lon lon 0 END 2:lat replicate 1 jpi temporary lat ELSE:stop ENDCASE END lon is 1D array and lat is 2D array sizelon 0 EQ 1 AND sizelat 0 EQ 2:BEGIN get jpi and jpj jpi sizelat 1 jpj sizelat 2 IF jpi NE n_elements lon THEN stop make sure that lon and lat have the good number of dimensions CASE n_dimensions OF 1:BEGIN IF array_equal lat replicate 1 jpi lat 0 NE 1 THEN BEGIN print Latitudes are not the same for all longitudes imposible to extract a 1D array of the latitudes stop ENDIF lat reform lat 0 END 2:lon temporary lon replicate 1 jpj ELSE:stop ENDCASE END lon and lat are 2D arrays sizelon 0 EQ 2 AND sizelat 0 EQ 2:BEGIN get jpi and jpj IF array_equal sizelon 1:2 sizelat 1:2 NE 1 THEN stop jpi sizelon 1 jpj sizelon 2 make sure that lon and lat have the good number of dimensions CASE n_dimensions OF 1:BEGIN IF array_equal lon lon 0 replicate 1 jpj NE 1 THEN BEGIN print Longitudes are not the same for all latitudes imposible to extract a 1D array of the longitudes stop ENDIF lon lon 0 IF array_equal lat replicate 1 jpi reform lat 0 NE 1 THEN BEGIN print Latitudes are not the same for all longitudes imposible to extract a 1D array of the latitudes stop ENDIF lat reform lat 0 END 2: ELSE:stop ENDCASE END lon and lat are not 1D and or 2D arrays ELSE:stop ENDCASE double keyword if keyword_set double then BEGIN lon double temporary lon lat double temporary lat ENDIF give back the right outparameters CASE n_params OF 8:BEGIN in4 temporary lon in5 temporary lat in6 temporary jpi in7 temporary jpj END 5:BEGIN in1 temporary lon in2 temporary lat in3 temporary jpi in4 temporary jpj END ENDCASE return END"); 63 63 a[61] = new Array("./Interpolation/imoms3.html", "imoms3.pro", "", " param xin in required version Id: imoms3 pro 134 2006 07 07 10:19:08Z navarro FUNCTION imoms3 xin compile_opt idl2 strictarrsubs x abs xin y fltarr n_elements x test1 where x LT 1 IF test1 0 NE 1 THEN BEGIN xtmp x test1 y test1 0 5 xtmp xtmp xtmp xtmp xtmp 0 5 xtmp 1 ENDIF test1 where x LT 2 AND x GE 1 IF test1 0 NE 1 THEN BEGIN xtmp x test1 y test1 1 6 xtmp xtmp xtmp xtmp xtmp 11 6 xtmp 1 ENDIF RETURN y END"); … … 197 197 a[195] = new Array("./ToBeReviewed/CALCULS/norme.html", "norme.pro", "", " file_comments calculate the norm of a field of vectors then make a possible average Comment 1: The field of vector can be 2d:xy 3d: xyz or xyt 4d: xyzt Comment 2: The calculation of the norm is made before the possible spatial or temporal average because the average of the norm is not equal to the norm of averages categories Calculation param COMPOSANTEU in required an 2d 3d or 4d array param COMPOSANTEV in required an 2d 3d or 4d array keyword BOXZOOM boxzoom on which do the average by default the domain selected by the last domdef done keyword DIREC t x y z xys xz yz xyz xt yt zt xyt xzt yzt xyzt Direction on which do averages returns Array to trace with plt pltz or pltt uses common pro restrictions The norm is calculated on points TTo do this calculation we average field U and Von points T before calculate the norme At the edge of coast and of domain we can not calculate fields U and V at points T that is why these points are at value values f_nan When we calculate on a reduce geographic domain field U and V have not necessarily the same number of point In this case we recut U and V to keep only common points We profit of this to redo a domdef which redefine a geographic domain on which fields U and V are extracted on same points restrictions To know what type of array we work with we test its size and dates gave by time 0 and time jpt 1 to know if thee is a temporal dimension Before to start norme make sure that time and jpt are defined how they have to examples To calculate the average of the norme of streams on all the domain between 0 et 50: IDL res norme un vn boxzoom 0 50 dir xyz history Sebastien Masson smasson lodyc jussieu fr 9 6 1999 version Id: norme pro 163 2006 08 29 12:59:46Z navarro FUNCTION norme composanteu composantev BOXZOOM boxzoom DIREC direc _extra ex compile_opt idl2 strictarrsubs cm_4mesh cm_4data cm_4cal IF NOT keyword_set key_forgetold THEN BEGIN updatenew updatekwd ENDIF tempsun systime 1 To key_performance IF finite glamu 0 finite gphiu 0 finite glamv 0 finite gphiv 0 EQ 0 THEN return report This version of norme is based on Arakawa C grid U and V grids must therefore be defined if keyword_set boxzoom then BEGIN Case 1 Of N_Elements Boxzoom Eq 1:bte lon1 lon2 lat1 lat2 0 boxzoom 0 N_Elements Boxzoom Eq 2:bte lon1 lon2 lat1 lat2 boxzoom 0 boxzoom 1 N_Elements Boxzoom Eq 4:bte Boxzoom vert1 vert2 N_Elements Boxzoom Eq 5:bte Boxzoom 0:3 0 Boxzoom 4 N_Elements Boxzoom Eq 6:bte Boxzoom Else: return report Mauvaise Definition de Boxzoom ENDCASE domdef boxzoom ENDIF if NOT keyword_set direc then direc 0 construction of u and v at points T u litchamp composanteu v litchamp composantev date1 time 0 if n_elements jpt EQ 0 then date2 date1 ELSE date2 time jpt 1 if size u 0 NE size v 0 then return 1 vargrid T varname norme valmask 1e20 grilleu litchamp composanteu grid if grilleu EQ then grilleu U grillev litchamp composantev grid if grillev EQ then grillev V IF grilleu EQ V AND grillev EQ U THEN inverse 1 IF grilleu EQ T AND grillev EQ T THEN BEGIN interpolle 0 return report cas non code mais facile a faire ENDIF ELSE interpolle 1 if keyword_set inverse then begin rien u u v v rien endif We find common points between u and v indicexu lindgen jpi firstxu:firstxu nxu 1 indicexv lindgen jpi firstxv:firstxv nxv 1 indicex inter indicexu indicexv indiceyu lindgen jpj firstyu:firstyu nyu 1 indiceyv lindgen jpj firstyv:firstyv nyv 1 indicey inter indiceyu indiceyv nx n_elements indicex ny n_elements indicey case 1 of xyz size u 0 EQ 3 AND date1 EQ date2 :BEGIN indice2d lindgen jpi jpj indice2d indice2d indicex 0 :indicex 0 nx 1 indicey 0 :indicey 0 ny 1 indice3d lindgen jpi jpj jpk indice3d indice3d indicex 0 :indicex 0 nx 1 indicey 0 :indicey 0 ny 1 firstzt:lastzt extraction of u and v on the appropriated domain case 1 of size u 1 EQ nxu AND size u 2 EQ nyu AND size v 1 EQ nxv AND size v 2 EQ nyv:BEGIN case size u 3 OF nzt:BEGIN if nxu NE nx then if indicex 0 EQ firstxu then u u 0:nx 1 ELSE u u 1: nx IF nxv NE nx THEN if indicex 0 EQ firstxv then v v 0:nx 1 ELSE v v 1: nx IF nyu NE ny THEN if indicey 0 EQ firstyu then u u 0:ny 1 ELSE u u 1: ny IF nyv NE ny THEN if indicey 0 EQ firstyv then v v 0:ny 1 ELSE v v 1: ny end jpk:BEGIN if nxu NE nx then if indicex 0 EQ firstxu then u u 0:nx 1 firstzt:lastzt ELSE u u 1: nx firstzt:lastzt IF nxv NE nx THEN if indicex 0 EQ firstxv then v v 0:nx 1 firstzt:lastzt ELSE v v 1: nx firstzt:lastzt IF nyu NE ny THEN if indicey 0 EQ firstyu then u u 0:ny 1 firstzt:lastzt ELSE u u 1: ny firstzt:lastzt IF nyv NE ny THEN if indicey 0 EQ firstyv then v v 0:ny 1 firstzt:lastzt ELSE v v 1: ny firstzt:lastzt end ELSE: return report problemes d adequation entre la taille du domaine et la taille des matrices necessaires a tracer des vecteurs endcase END size u 1 EQ jpi AND size u 2 EQ jpj AND size u 3 EQ jpk AND size v 1 EQ jpi AND size v 2 EQ jpj AND size u 3 EQ jpk :BEGIN u u indice3d v v indice3d END ELSE: return report problemes d adequation entre la taille du domaine et la taille des matrices necessaires a tracer des vecteurs endcase We reshape u and v to make sure that no dimension has been erased if nzt EQ 1 then begin u reform u nx ny nzt over v reform v nx ny nzt over endif construction of u and v at points T a u 0 u u shift u 1 0 0 2 if NOT keyword_set key_periodic OR nx NE jpi then u 0 a a v 0 v v shift v 0 1 0 2 if NOT keyword_set key_periodic OR nx NE jpi then v 0 a attribution of the mask and of logitude and latitude arrays mask tmask indice3d if nzt EQ 1 then mask reform mask nx ny nzt over if n_elements valmask EQ 0 THEN valmask 1e20 landu where u GE valmask 10 if landu 0 NE 1 then u landu 0 landv where v GE valmask 10 if landv 0 NE 1 then v landv 0 res sqrt u 2 v 2 if NOT keyword_set key_periodic OR nx NE jpi then res 0 values f_nan res 0 values f_nan mask where mask eq 0 IF mask 0 NE 1 THEN res mask valmask All kind of average domdef glamt indice2d 0 0 glamu indice2d nx 1 0 gphit indice2d 0 0 gphiv indice2d 0 ny 1 vert1 vert2 meme if keyword_set direc then res moyenne res direc nan boxzoom boxzoom nodomdef END xyt date1 NE date2 AND size u 0 EQ 3 :BEGIN indice2d lindgen jpi jpj indice2d indice2d indicex 0 :indicex 0 nx 1 indicey 0 :indicey 0 ny 1 extraction of u and v on the appropriated domain case 1 of size u 1 EQ nxu AND size u 2 EQ nyu AND size v 1 EQ nxv AND size v 2 EQ nyv:BEGIN if nxu NE nx then if indicex 0 EQ firstxu then u u 0:nx 1 ELSE u u 1: nx IF nxv NE nx THEN if indicex 0 EQ firstxv then v v 0:nx 1 ELSE v v 1: nx IF nyu NE ny THEN if indicey 0 EQ firstyu then u u 0:ny 1 ELSE u u 1: ny IF nyv NE ny THEN if indicey 0 EQ firstyv then v v 0:ny 1 ELSE v v 1: ny END size u 1 EQ jpi AND size u 2 EQ jpj AND size v 1 EQ jpi AND size v 2 EQ jpj:BEGIN u u indicex 0 :indicex 0 nx 1 indicey 0 :indicey 0 ny 1 v v indicex 0 :indicex 0 nx 1 indicey 0 :indicey 0 ny 1 END ELSE:return report problemes d adequation entre la taille du domaine et la taille des matrices necessaires a tracer des vecteurs endcase construction of u and v at points T a u 0 u u shift u 1 0 0 2 if NOT keyword_set key_periodic OR nx NE jpi then u 0 a a v 0 v v shift v 0 1 0 2 if NOT keyword_set key_periodic OR nx NE jpi then v 0 a attribution of the mask and of longitude and latitude arrays We recover the complete grid to establish a big mask extent in the four direction to cover pointsfor which a land point has been considerated make a small drawing mask tmask indice2d jpi jpj firstzt if ny EQ 1 then mask reform mask nx ny over construction of land containing all points to mask if n_elements valmask EQ 0 THEN valmask 1e20 landu where u GE valmask 10 if landu 0 NE 1 then u landu 0 landv where v GE valmask 10 if landv 0 NE 1 then v landv 0 res sqrt u 2 v 2 if NOT keyword_set key_periodic OR nx NE jpi then res 0 values f_nan res 0 values f_nan mask where mask eq 0 IF mask 0 NE 1 THEN BEGIN coeftps lindgen jpt nx ny coeftps replicate 1 n_elements mask coeftps mask temporary mask replicate 1 jpt mask temporary mask temporary coeftps res temporary mask valmask ENDIF moyennes en tous genres domdef glamt indice2d 0 0 glamu indice2d nx 1 0 gphit indice2d 0 0 gphiv indice2d 0 ny 1 vert1 vert2 meme if keyword_set direc then res grossemoyenne res direc nan boxzoom boxzoom nodomdef END xyzt date1 NE date2 AND size u 0 EQ 4:BEGIN indice2d lindgen jpi jpj indice2d indice2d indicex 0 :indicex 0 nx 1 indicey 0 :indicey 0 ny 1 indice3d lindgen jpi jpj jpk indice3d indice3d indicex 0 :indicex 0 nx 1 indicey 0 :indicey 0 ny 1 firstzt:lastzt extraction of u and v on the appropriated domain case 1 of size u 1 EQ nxu AND size u 2 EQ nyu AND size v 1 EQ nxv AND size v 2 EQ nyv:BEGIN case size u 3 OF nzt:BEGIN if nxu NE nx then if indicex 0 EQ firstxu then u u 0:nx 1 ELSE u u 1: nx IF nxv NE nx THEN if indicex 0 EQ firstxv then v v 0:nx 1 ELSE v v 1: nx IF nyu NE ny THEN if indicey 0 EQ firstyu then u u 0:ny 1 ELSE u u 1: ny IF nyv NE ny THEN if indicey 0 EQ firstyv then v v 0:ny 1 ELSE v v 1: ny end jpk:BEGIN if nxu NE nx then if indicex 0 EQ firstxu then u u 0:nx 1 firstzt:lastzt ELSE u u 1: nx firstzt:lastzt IF nxv NE nx THEN if indicex 0 EQ firstxv then v v 0:nx 1 firstzt:lastzt ELSE v v 1: nx firstzt:lastzt IF nyu NE ny THEN if indicey 0 EQ firstyu then u u 0:ny 1 firstzt:lastzt ELSE u u 1: ny firstzt:lastzt IF nyv NE ny THEN if indicey 0 EQ firstyv then v v 0:ny 1 firstzt:lastzt ELSE v v 1: ny firstzt:lastzt end ELSE: return report problemes d adequation entre la taille du domaine et la taille des matrices necessaires a tracer des vecteurs endcase END size u 1 EQ jpi AND size u 2 EQ jpj AND size u 3 EQ jpk AND size v 1 EQ jpi AND size v 2 EQ jpj AND size u 3 EQ jpk :BEGIN u u indicex 0 :indicex 0 nx 1 indicey 0 :indicey 0 ny 1 firstzt:lastzt v v indicex 0 :indicex 0 nx 1 indicey 0 :indicey 0 ny 1 firstzt:lastzt END ELSE: return report problemes d adequation entre la taille du domaine et la taille des matrices necessaires a tracer des vecteurs endcase construction of u and v at points T a u 0 u u shift u 1 0 0 0 2 if NOT keyword_set key_periodic OR nx NE jpi then u 0 a a v 0 v v shift v 0 1 0 0 2 if NOT keyword_set key_periodic OR nx NE jpi then v 0 a attribution of the mask and of logitude and latitude arrays mask tmask indice3d if nzt EQ 1 then mask reform mask nx ny nzt over if n_elements valmask EQ 0 THEN valmask 1e20 landu where u GE valmask 10 if landu 0 NE 1 then u landu 0 landv where v GE valmask 10 if landv 0 NE 1 then v landv 0 res sqrt u 2 v 2 if NOT keyword_set key_periodic OR nx NE jpi then res 0 values f_nan res 0 values f_nan mask where mask eq 0 IF mask 0 NE 1 THEN BEGIN coeftps lindgen jpt nx ny nzt coeftps replicate 1 n_elements mask coeftps mask temporary mask replicate 1 jpt mask temporary mask temporary coeftps res temporary mask valmask ENDIF All kind of average domdef glamt indice2d 0 0 glamu indice2d nx 1 0 gphit indice2d 0 0 gphiv indice2d 0 ny 1 vert1 vert2 meme if keyword_set direc then res grossemoyenne res direc nan boxzoom boxzoom nodomdef END xy ELSE:BEGIN xy indice2d lindgen jpi jpj indice2d indice2d indicex 0 :indicex 0 nx 1 indicey 0 :indicey 0 ny 1 extraction of u and v on the appropriated domain case 1 of size u 1 EQ nxu AND size u 2 EQ nyu AND size v 1 EQ nxv AND size v 2 EQ nyv:BEGIN if nxu NE nx then if indicex 0 EQ firstxu then u u 0:nx 1 ELSE u u 1: nx IF nxv NE nx THEN if indicex 0 EQ firstxv then v v 0:nx 1 ELSE v v 1: nx IF nyu NE ny THEN if indicey 0 EQ firstyu then u u 0:ny 1 ELSE u u 1: ny IF nyv NE ny THEN if indicey 0 EQ firstyv then v v 0:ny 1 ELSE v v 1: ny END size u 1 EQ jpi AND size u 2 EQ jpj AND size v 1 EQ jpi AND size v 2 EQ jpj:BEGIN u u indice2d v v indice2d END ELSE:return report problemes d adequation entre la taille du domaine et la taille des matrices necessaires a tracer des vecteurs endcase We reshape u and v to make sure that no dimension has been erased if ny EQ 1 then begin u reform u nx ny over v reform v nx ny over endif construction of u and v at points T a u 0 u u shift u 1 0 2 if NOT keyword_set key_periodic OR nx NE jpi then u 0 a a v 0 v v shift v 0 1 2 if NOT keyword_set key_periodic OR nx NE jpi then v 0 a attribution of the mask and of longitude and latitude arrays We recover the complete grid to establish a big mask extent in the four direction to cover pointsfor which a land point has been considerated make a small drawing mask tmask indice2d jpi jpj firstzt if nyt EQ 1 THEN mask reform mask nx ny over construction of land containing all points to mask if n_elements valmask EQ 0 THEN valmask 1e20 landu where u GE valmask 10 if landu 0 NE 1 then u landu 0 landv where v GE valmask 10 if landv 0 NE 1 then v landv 0 res sqrt u 2 v 2 if NOT keyword_set key_periodic OR nx NE jpi then res 0 values f_nan res 0 values f_nan mask where mask eq 0 IF mask 0 NE 1 THEN res mask valmask All kind of average domdef glamt indice2d 0 0 glamu indice2d nx 1 0 gphit indice2d 0 0 gphiv indice2d 0 ny 1 vert1 vert2 meme if keyword_set direc then res moyenne res direc nan boxzoom boxzoom nodomdef END endcase if keyword_set key_performance THEN print temps norme systime 1 tempsun return res end"); 198 198 a[196] = new Array("./ToBeReviewed/CALCULS/projectondepth.html", "projectondepth.pro", "", " file_comments Allows to project a 3d field following a depth array categories Without loop param ARRAYIN type 3d array It is a 3d array whose 3rd dimension must be equal to jpk param DEPTHIN type 2d array It is a 2d array indicating for each point n at which depth to project returns A 2d array which is the projection of the 3d array following depths indicated by depthin uses common pro restrictions points at values f_nan impossible calculation Land points masked at valmask examples we build a possible depths array IDL a gdept jpk 1 1 jpi jpj findgen jpi jpj We build an array to project on these depths For the test we build a 3d array whose each vector following z is the depth IDL arraytest replicate 1 jpi jpj gdept IDL arraytest reform arraytest jpi jpj jpk over We test the projection of the depth array on the depth IDL plt 1e6 a projectondepth arraytest a nocontour null field at 1e 6 pres verifcation projecting the temperature of 20 C for example history Sebastien Masson smasson lodyc jussieu fr 15 6 2000 version Id: projectondepth pro 163 2006 08 29 12:59:46Z navarro FUNCTION projectondepth arrayin depthin compile_opt idl2 strictarrsubs tempsun systime 1 To key_performance common depth litchamp depthin array litchamp arrayin Small verifications tailledepth size depth taillearray size array if tailledepth 0 NE 2 THEN return report Depth array must have 2 dimensions if taillearray 0 NE 3 THEN return report Array in must have 3 dimensions verification of the coherence between array s size and the domain grille mask 1 1 1 nx ny nz firstx firsty firstz lastx lasty lastz case 1 of tailledepth 1 eq jpi and tailledepth 2 eq jpj:depth depth firstx:lastx firsty:lasty tailledepth 1 eq nx and tailledepth 2 eq ny: else:return report Probleme d adequation entre les tailles du domaine et celle du tableau de profondeur endcase case 1 OF taillearray 3 NE jpk:return report Le tableau 3d doit avoir sa 3eme dimension egale a jpk taillearray 1 eq jpi and taillearray 2 eq jpj:array array firstx:lastx firsty:lasty taillearray 1 eq nx and taillearray 2 eq ny: else:return report Probleme d adequation entre les tailles du domaine et celle du tableau de profondeur endcase c est parti flevel depth2floatlevel depth we delete points at values f_nan notanumber where finite flevel nan EQ 1 if notanumber 0 NE 1 then flevel notanumber 0 we sill delete land points at valmask for example flevel 0 flevel jpk 1 indexup level2index floor flevel indexlow nx ny indexup out where indexlow GE nx ny jpk 1 if out 0 NE 1 then indexlow out indexlow out nx ny weight flevel floor flevel res array indexup res res weight array indexlow res We put back points at values f_nan if notanumber 0 NE 1 then res notanumber values f_nan if out 0 NE 1 then res out values f_nan We mask land points at valmask if n_elements valmask EQ 0 then valmask 1e20 terre where temporary mask 0 EQ 0 if terre 0 NE 1 then res terre valmask if keyword_set key_performance THEN print temps projectondepth systime 1 tempsun return res end"); 199 a[197] = new Array("./ToBeReviewed/CALCULS/remplit.html", "remplit.pro", "", " file_comments categories param ZINPUT keyword NAN keyword NITER keyword BASIQUE keyword MASK keyword FILLXDIR keyword FILLYDIR keyword FILLVAL keyword _EXTRA Used to pass your keywords returns uses restrictions examples history version Id: remplit pro 163 2006 08 29 12:59:46Z navarro Extrapole zinout jpi jpj sur les continents en utilisant les 4 plus proches voisins masques oceaniquement et construit un nouveau masque contenant l ancien masque oceanique PLUSles points extrapoles Reitere le processus niter fois C est pas clair essayez Nan: to fill the point which have the value values f_nan Whitout this keyword these point are not filling and stays at values f_nan todo seb FUNCTION remplit zinput NAN nan NITER niter BASIQUE basique mask mask FILLXDIR fillxdir FILLYDIR fillydir FILLVAL fillval _extra ex compile_opt idl2 strictarrsubs common tempsun systime 1 pour key_performance les points non remplis sont masques a valmask IF n_elements niter EQ 0 THEN niter 1 IF niter EQ 0 THEN return zinput z zinput if n_elements key_gridtype EQ 0 then key_gridtype c if keyword_set basique then begin oldkey_gridtype key_gridtype key_gridtype c nx size zinput 1 ny size zinput 2 if NOT keyword_set mask then mmmask basique ELSE mmmask mask if key_gridtype eq e then begin case vargrid of T :glam glamt firstxt:lastxt firstyt:lastyt U :glam glamu firstxu:lastxu firstyu:lastyu endcase endif ENDIF ELSE grille mmmask glam gphi gdep nx ny nz _extra ex if keyword_set mask then mmmask mask if size mmmask 0 EQ 3 THEN mmmask mmmask 0 if n_elements mmmask EQ 1 then mmmask replicate 1b nx ny if keyword_set nan then begin nanpoint where finite z EQ 0 if nanpoint 0 NE 1 then begin mmmask nanpoint 0b z nanpoint 0 endif ENDIF mmmask byte mmmask on ajoute un cadre de zero a z mask e1 e2 comme ca apres on peut faire des shifts ds tous les sens sans se soucier des bords du domaine tempdeux systime 1 pour key_performance 2 nx2 nx 2 case key_gridtype of c :BEGIN ztmp bytarr nx 2 ny 2 ztmp 1:nx 1:ny mmmask mmmask temporary ztmp ztmp fltarr nx 2 ny 2 ztmp 1:nx 1:ny z if keyword_set key_periodic AND nx EQ jpi then begin ztmp 0 1:ny z jpi 1 ztmp nx 1 1:ny z 0 endif z temporary ztmp END e :BEGIN ztmp bytarr nx 2 ny 4 ztmp 1:nx 2:ny 1 mmmask mmmask temporary ztmp ztmp fltarr nx 2 ny 4 ztmp 1:nx 2:ny 1 z if keyword_set key_periodic AND nx EQ jpi then begin ztmp 0 2:ny 1 z jpi 1 ztmp nx 1 2:ny 1 z 0 endif z temporary ztmp END endcase IF testvar var key_performance EQ 2 THEN print temps remplit: on ajoute un cadre de zero systime 1 tempdeux iteration FOR n 1 niter DO BEGIN on trouve les points coast tempdeux systime 1 pour key_performance 2 les points du bord du cadre ne doivent pas etre selectionnes comme la coast case key_gridtype of c :BEGIN mmmask 0 1b mmmask nx 1 1b mmmask 0 1b mmmask ny 1 1b END e :BEGIN mmmask 0 1b mmmask nx 1 1b mmmask 0:1 1b mmmask ny 2:ny 3 1b END endcase liste des points terre restant IF keyword_set fillxdir THEN BEGIN we stop if all the lines that contains data have been filled test total mmmask 1:nx 1 IF total test EQ 0 test EQ nx EQ ny 2 THEN GOTO fini ENDIF IF keyword_set fillydir THEN BEGIN we stop if all the columns that contains data have been filled test total mmmask 1:ny 2 IF total test EQ 0 test EQ ny EQ nx 2 THEN GOTO fini ENDIF land where mmmask EQ 0 if land 0 EQ 1 then GOTO fini les points du bord du cadre doivent maintenant etre dans la terre case key_gridtype of c :BEGIN mmmask 0 0b mmmask nx 1 0b mmmask 0 0b mmmask ny 1 0b END e :BEGIN mmmask 0 0b mmmask nx 1 0b mmmask 0:1 0b mmmask ny 2:ny 3 0b END endcase if keyword_set key_periodic AND nx EQ jpi then begin mmmask 0 mmmask nx mmmask nx 1 mmmask 1 endif liste des voisins mer case key_gridtype of c :BEGIN CASE 1 OF keyword_set fillxdir :weight mmmask 1 land mmmask 1 land keyword_set fillydir :weight mmmask nx2 land mmmask nx2 land ELSE:weight mmmask 1 land mmmask 1 land mmmask nx2 land mmmask nx2 land 1 sqrt 2 mmmask nx2 1 land mmmask nx2 1 land mmmask nx2 1 land mmmask nx2 1 land ENDCASE END e :BEGIN shifted glam 0 0 LT glam 0 1 oddeven land nx2 1 shifted MOD 2 weight mmmask 1 land mmmask 1 land mmmask 2 nx2 land mmmask 2 nx2 land sqrt 2 mmmask nx2 oddeven land mmmask nx2 1 oddeven land mmmask nx2 oddeven land mmmask nx2 1 oddeven land END endcase ok where weight GT 0 weight weight ok coast land temporary ok IF testvar var key_performance EQ 2 THEN print temps remplit: trouver la coast systime 1 tempdeux remplissage des points coast tempdeux systime 1 pour key_performance 2 on masque z z temporary z mmmask case key_gridtype of c :BEGIN CASE 1 OF keyword_set fillxdir :zcoast z 1 coast z 1 coast keyword_set fillydir :zcoast z nx2 coast z nx2 coast ELSE:zcoast z 1 coast z 1 coast z nx2 coast z nx2 coast 1 sqrt 2 z nx2 1 coast z nx2 1 coast z nx2 1 coast z nx2 1 coast ENDCASE END e :BEGIN oddeven coast nx2 1 shifted MOD 2 zcoast z 1 coast z 1 coast z 2 nx2 coast z 2 nx2 coast sqrt 2 z nx2 oddeven coast z nx2 1 oddeven coast z nx2 oddeven coast z nx2 1 oddeven coast END endcase z coast temporary zcoast temporary weight we update the the boundary conditions of z if keyword_set key_periodic AND nx EQ jpi then begin z 0 z nx z nx 1 z 1 endif IV on reduit le masque mmmask temporary coast 1 IF testvar var key_performance EQ 2 THEN print temps remplit: une iteration systime 1 tempdeux ENDFOR fini: on masque les valeurs sur les lands restantes IF n_elements valmask EQ 0 then valmask 1e20 IF n_elements fillval EQ 0 THEN fillval valmask z temporary z mmmask fillval 1b mmmask on redecoupe le tableau pour retirer le cadre case key_gridtype of c :BEGIN z z 1:nx 1:ny END e :BEGIN z z 1:nx 2:ny 1 END endcase if keyword_set basique thenkey_gridtype oldkey_gridtype if keyword_set key_performance THEN print temps remplit systime 1 tempsun return z END ");199 a[197] = new Array("./ToBeReviewed/CALCULS/remplit.html", "remplit.pro", "", " file_comments categories param ZINPUT keyword NAN keyword NITER keyword BASIQUE keyword MASK keyword FILLXDIR keyword FILLYDIR keyword FILLVAL keyword _EXTRA Used to pass your keywords returns uses restrictions examples history version Id: remplit pro 209 2007 02 08 10:01:49Z smasson Extrapole zinout jpi jpj sur les continents en utilisant les 4 plus proches voisins masques oceaniquement et construit un nouveau masque contenant l ancien masque oceanique PLUSles points extrapoles Reitere le processus niter fois C est pas clair essayez Nan: to fill the point which have the value values f_nan Whitout this keyword these point are not filling and stays at values f_nan todo seb FUNCTION remplit zinput NAN nan NITER niter BASIQUE basique mask mask FILLXDIR fillxdir FILLYDIR fillydir FILLVAL fillval _extra ex compile_opt idl2 strictarrsubs common tempsun systime 1 pour key_performance les points non remplis sont masques a valmask IF n_elements niter EQ 0 THEN niter 1 IF niter EQ 0 THEN return zinput z zinput if n_elements key_gridtype EQ 0 then key_gridtype c oldkey_gridtype key_gridtype keep only the first letter of the grid type key_gridtype strmid key_gridtype 0 1 if keyword_set basique then begin key_gridtype c nx size zinput 1 ny size zinput 2 if NOT keyword_set mask then mmmask basique ELSE mmmask mask ENDIF ELSE grille mmmask glam gphi gdep nx ny nz _extra ex if keyword_set mask then mmmask mask if size mmmask 0 EQ 3 THEN mmmask mmmask 0 if n_elements mmmask EQ 1 then mmmask replicate 1b nx ny if keyword_set nan then begin nanpoint where finite z EQ 0 if nanpoint 0 NE 1 then begin mmmask nanpoint 0b z nanpoint 0 endif ENDIF mmmask byte mmmask on ajoute un cadre de zero a z mask e1 e2 comme ca apres on peut faire des shifts ds tous les sens sans se soucier des bords du domaine tempdeux systime 1 pour key_performance 2 nx2 nx 2 case key_gridtype of c :BEGIN ztmp bytarr nx 2 ny 2 ztmp 1:nx 1:ny mmmask mmmask temporary ztmp ztmp fltarr nx 2 ny 2 ztmp 1:nx 1:ny z if keyword_set key_periodic AND nx EQ jpi then begin ztmp 0 1:ny z jpi 1 ztmp nx 1 1:ny z 0 endif z temporary ztmp END e :BEGIN ztmp bytarr nx 2 ny 4 ztmp 1:nx 2:ny 1 mmmask mmmask temporary ztmp ztmp fltarr nx 2 ny 4 ztmp 1:nx 2:ny 1 z if keyword_set key_periodic AND nx EQ jpi then begin ztmp 0 2:ny 1 z jpi 1 ztmp nx 1 2:ny 1 z 0 endif z temporary ztmp END endcase IF testvar var key_performance EQ 2 THEN print temps remplit: on ajoute un cadre de zero systime 1 tempdeux iteration FOR n 1 niter DO BEGIN on trouve les points coast tempdeux systime 1 pour key_performance 2 les points du bord du cadre ne doivent pas etre selectionnes comme la coast case key_gridtype of c :BEGIN mmmask 0 1b mmmask nx 1 1b mmmask 0 1b mmmask ny 1 1b END e :BEGIN mmmask 0 1b mmmask nx 1 1b mmmask 0:1 1b mmmask ny 2:ny 3 1b END endcase liste des points terre restant IF keyword_set fillxdir THEN BEGIN we stop if all the lines that contains data have been filled test total mmmask 1:nx 1 IF total test EQ 0 test EQ nx EQ ny 2 THEN GOTO fini ENDIF IF keyword_set fillydir THEN BEGIN we stop if all the columns that contains data have been filled test total mmmask 1:ny 2 IF total test EQ 0 test EQ ny EQ nx 2 THEN GOTO fini ENDIF land where mmmask EQ 0 if land 0 EQ 1 then GOTO fini les points du bord du cadre doivent maintenant etre dans la terre case key_gridtype of c :BEGIN mmmask 0 0b mmmask nx 1 0b mmmask 0 0b mmmask ny 1 0b END e :BEGIN mmmask 0 0b mmmask nx 1 0b mmmask 0:1 0b mmmask ny 2:ny 3 0b END endcase if keyword_set key_periodic AND nx EQ jpi then begin mmmask 0 mmmask nx mmmask nx 1 mmmask 1 endif liste des voisins mer case key_gridtype of c :BEGIN CASE 1 OF keyword_set fillxdir :weight mmmask 1 land mmmask 1 land keyword_set fillydir :weight mmmask nx2 land mmmask nx2 land ELSE:weight mmmask 1 land mmmask 1 land mmmask nx2 land mmmask nx2 land 1 sqrt 2 mmmask nx2 1 land mmmask nx2 1 land mmmask nx2 1 land mmmask nx2 1 land ENDCASE END e :BEGIN shifted glam 0 0 LT glam 0 1 oddeven land nx2 1 shifted MOD 2 weight mmmask 1 land mmmask 1 land mmmask 2 nx2 land mmmask 2 nx2 land sqrt 2 mmmask nx2 oddeven land mmmask nx2 1 oddeven land mmmask nx2 oddeven land mmmask nx2 1 oddeven land END endcase ok where weight GT 0 weight weight ok coast land temporary ok IF testvar var key_performance EQ 2 THEN print temps remplit: trouver la coast systime 1 tempdeux remplissage des points coast tempdeux systime 1 pour key_performance 2 on masque z z temporary z mmmask case key_gridtype of c :BEGIN CASE 1 OF keyword_set fillxdir :zcoast z 1 coast z 1 coast keyword_set fillydir :zcoast z nx2 coast z nx2 coast ELSE:zcoast z 1 coast z 1 coast z nx2 coast z nx2 coast 1 sqrt 2 z nx2 1 coast z nx2 1 coast z nx2 1 coast z nx2 1 coast ENDCASE END e :BEGIN oddeven coast nx2 1 shifted MOD 2 zcoast z 1 coast z 1 coast z 2 nx2 coast z 2 nx2 coast sqrt 2 z nx2 oddeven coast z nx2 1 oddeven coast z nx2 oddeven coast z nx2 1 oddeven coast END endcase z coast temporary zcoast temporary weight we update the the boundary conditions of z if keyword_set key_periodic AND nx EQ jpi then begin z 0 z nx z nx 1 z 1 endif IV on reduit le masque mmmask temporary coast 1 IF testvar var key_performance EQ 2 THEN print temps remplit: une iteration systime 1 tempdeux ENDFOR fini: on masque les valeurs sur les lands restantes IF n_elements valmask EQ 0 then valmask 1e20 IF n_elements fillval EQ 0 THEN fillval valmask z temporary z mmmask fillval 1b mmmask on redecoupe le tableau pour retirer le cadre case key_gridtype of c :BEGIN z z 1:nx 1:ny END e :BEGIN z z 1:nx 2:ny 1 END endcase key_gridtype oldkey_gridtype if keyword_set key_performance THEN print temps remplit systime 1 tempsun return z END "); 200 200 a[198] = new Array("./ToBeReviewed/CALCULS/rhon.html", "rhon.pro", "", " file_comments categories param SN param TN keyword INSITU keyword SIGMA_N returns uses restrictions examples history version Id: rhon pro 163 2006 08 29 12:59:46Z navarro Calcul de la fonction d etat issue de eos F Creation : 1997 G Roullet adaptation pour les tableaux z zt xyz xyzt par seb todo seb FUNCTION rhon sn tn INSITU insitu SIGMA_N sigma_n compile_opt idl2 strictarrsubs common tempsun systime 1 pour key_performance sn 1e5 double sn double tn 1e5 IF keyword_set sigma_n then insitu 1 taille size sn case taille 0 of 0:BEGIN z zrhop 0d jkmax 1 END 1:BEGIN z zrhop dblarr taille 1 jkmax taille 1 END 2:BEGIN xy jpt 1 ou zt zrhop dblarr taille 1 taille 2 if jpt EQ 1 then jkmax 1 ELSE jkmax taille 1 END 3:BEGIN xyz jpt 1 ou xyt zrhop dblarr taille 1 taille 2 taille 3 if jpt EQ 1 then jkmax taille 3 ELSE jkmax 1 END 4:BEGIN xyzt zrhop dblarr taille 1 taille 2 taille 3 taille 4 jkmax taille 3 END endcase FOR jk 0 jkmax 1 DO BEGIN case taille 0 of 0:BEGIN z ztt tn zs sn END 1:BEGIN z ztt tn jk zs sn jk END 2:BEGIN xy jpt 1 ou zt if jpt EQ 1 then begin ztt tn zs sn ENDIF ELSE BEGIN ztt tn jk zs sn jk ENDELSE END 3:BEGIN xyz jpt 1 ou xyt if jpt EQ 1 then begin ztt tn jk zs sn jk endif ELSE BEGIN ztt tn zs sn ENDELSE END 4:BEGIN xyzt ztt tn jk zs sn jk END endcase if n_elements sigma_n NE 0 then zh 1000 sigma_n ELSE zh gdept jk square root salinity zsr sqrt abs zs compute density pure water at atm pressure zr1 6 536332e 9 ztt 1 120083e 6 ztt 1 001685e 4 ztt 9 095290e 3 ztt 6 793952e 2 ztt 999 842594 seawater density atm pressure zr2 5 3875e 9 ztt 8 2467e 7 ztt 7 6438e 5 ztt 4 0899e 3 ztt 0 824493 zr3 1 6546e 6 ztt 1 0227e 4 ztt 5 72466e 3 zr4 4 8314e 4 potential density reference to the surface case taille 0 of 0: zrhop zr4 zs zr3 zsr zr2 zs zr1 1: zrhop jk zr4 zs zr3 zsr zr2 zs zr1 2:BEGIN if jpt EQ 1 then zrhop zr4 zs zr3 zsr zr2 zs zr1 ELSE zrhop jk zr4 zs zr3 zsr zr2 zs zr1 END 3:BEGIN if jpt EQ 1 then zrhop jk zr4 zs zr3 zsr zr2 zs zr1 ELSE zrhop zr4 zs zr3 zsr zr2 zs zr1 END 4: zrhop jk zr4 zs zr3 zsr zr2 zs zr1 endcase IF n_elements insitu EQ 1 THEN BEGIN add the compression terms ze 3 508914e 8 ztt 1 248266e 8 ztt 2 595994e 6 zbw 1 296821e 6 ztt 5 782165e 9 ztt 1 045941e 4 zb zbw ze zs zd 2 042967e 2 zc 7 267926e 5 ztt 2 598241e 3 ztt 0 1571896 zaw 5 939910e 6 ztt 2 512549e 3 ztt 0 1028859 ztt 4 721788 za zd zsr zc zs zaw zb1 0 1909078 ztt 7 390729 ztt 55 87545 za1 2 326469e 3 ztt 1 553190 ztt 65 00517 ztt 1044 077 zkw 1 361629e 4 ztt 1 852732e 2 ztt 30 41638 ztt 2098 925 ztt 190925 6 zk0 zb1 zsr za1 zs zkw masked in situ density case taille 0 of 0: zrhop zrhop 1 0 zh zk0 zh za zh zb 1: zrhop jk zrhop jk 1 0 zh zk0 zh za zh zb 2:BEGIN if jpt EQ 1 then zrhop zrhop 1 0 zh zk0 zh za zh zb ELSE zrhop jk zrhop jk 1 0 zh zk0 zh za zh zb END 3:BEGIN if jpt EQ 1 then zrhop jk zrhop jk 1 0 zh zk0 zh za zh zb ELSE zrhop zrhop 1 0 zh zk0 zh za zh zb END 4: zrhop jk zrhop jk 1 0 zh zk0 zh za zh zb endcase ENDIF ENDFOR terre where tn GE 1e6 if terre 0 NE 1 then zrhop terre valmask if keyword_set key_performance THEN print temps rhon systime 1 tempsun return zrhop END "); 201 201 a[199] = new Array("./ToBeReviewed/CALENDRIER/def_month.html", "def_month.pro", "", " file_comments categories param TIMAVE param DATE returns uses restrictions examples history version Id: def_month pro 163 2006 08 29 12:59:46Z navarro todo seb FUNCTION def_month timave date translate month number in string compile_opt idl2 strictarrsubs IF strpos date _ GT 1 THEN date strmid date 0 strpos date _ CASE strmid timave 0 2 OF 1m : BEGIN CASE strmid date strlen date 2 2 OF 01 : mn January 02 : mn February 03 : mn March 04 : mn April 05 : mn May 06 : mn June 07 : mn July 08 : mn August 09 : mn September 10 : mn October 11 : mn November 12 : mn December ELSE: mn ENDCASE END 3m : BEGIN CASE strmid date strlen date 2 2 OF 01 : mn DJF 02 : mn MMA 03 : mn JJA 04 : mn SON ELSE: mn ENDCASE END ELSE: ENDCASE return mn END "); … … 209 209 a[207] = new Array("./ToBeReviewed/GRILLE/grille.html", "grille.pro", "", " file_comments Choose the grid which must be used to do the graph in function of vargrid and send back corresponding parameters calculated in domdef pro and reduced at the domain defined by domdef contrarily to grandegrille pro BEWARE The choice of the grid is made from the value of the global variable vargrid which can be equal to T U V W ou F categories keyword TRI This keyword serve to obtain thanks to grille the triangulation which refer to the grid but only on the part of the zoom This of triangulation is passed in the variable we have equate at TRI For example: grille tri triangulation_reduite This keyword is used in plt pro keyword WDEPTH To specify that the field is at W depth instead of T depth automatically activated if vargrid eq W keyword FORPLT In plt we want that land points glam and gphi be equal to glamt and gphit regardless of the grid keyword NOTRI Useful only when TRI is activated In this case grill send back 1 in the variable tri even if the variable of the common triangles_list is defined and different of 1 keyword _EXTRA Used to pass your keywords keyword TOUT param MASK out optional For the definition see domdef and the management of subdomains on the web param GLAM out optional For the definition see domdef and the management of subdomains on the web param GPHI out optional For the definition see domdef and the management of subdomains on the web param GDEP out optional For the definition see domdef and the management of subdomains on the web param NX out optional For the definition see domdef and the management of subdomains on the web param NY out optional For the definition see domdef and the management of subdomains on the web param NZ out optional For the definition see domdef and the management of subdomains on the web param FIRSTX out optional For the definition see domdef and the management of subdomains on the web param FIRSTY out optional For the definition see domdef and the management of subdomains on the web param FIRSTZ out optional For the definition see domdef and the management of subdomains on the web param LASTX out optional For the definition see domdef and the management of subdomains on the web param LASTY out optional For the definition see domdef and the management of subdomains on the web param LASTZ out optional For the definition see domdef and the management of subdomains on the web param E1 out optional For the definition see domdef and the management of subdomains on the web param E2 out optional For the definition see domdef and the management of subdomains on the web param E3 out optional For the definition see domdef and the management of subdomains on the web uses cm_4mesh cm_4data restrictions Use the variable vargrid restrictions Vargrid must be T W U V or F history Sebastien Masson smasson lodyc jussieu fr 12 2 1999 10 11 1999 forplt version Id: grille pro 172 2006 09 11 07:11:26Z smasson todo Comment ecrire la remarque sur les inputs pro grille mask glam gphi gdep nx ny nz firstx firsty firstz lastx lasty lastz e1 e2 e3 TRI tri NOTRI notri TOUT tout FORPLT forplt TYPE type WDEPTH wdepth _EXTRA ex include commons compile_opt idl2 strictarrsubs cm_4mesh cm_4data cm_4cal for jpt IF NOT keyword_set key_forgetold THEN BEGIN updatenew ENDIF tempsun systime 1 For key_performance vargrid strupcase strmid vargrid 0 reverse_offset if vargrid eq W then wdepth 1 if keyword_set tout then begin savedbox 1b saveboxparam boxparam4grille dat domdef gridtype vargrid _EXTRA ex endif tempdeux systime 1 For key_performance 2 IF keyword_set wdepth THEN BEGIN firstz firstzw lastz lastzw nz nzw ENDIF ELSE BEGIN firstz firstzt lastz lastzt nz nzt ENDELSE CASE 1 OF grid T and W vargrid eq T OR vargrid eq W : begin scalars nx nxt ny nyt firstx firstxt firsty firstyt lastx lastxt lasty lastyt 2d vectors IF arg_present glam THEN glam glamt firstx:lastx firsty:lasty IF arg_present gphi THEN gphi gphit firstx:lastx firsty:lasty IF arg_present e1 THEN e1 e1t firstx:lastx firsty:lasty IF arg_present e2 THEN e2 e2t firstx:lastx firsty:lasty 3d vectors IF keyword_set forplt THEN mask tmask firstx:lastx firsty:lasty firstz ELSE IF arg_present mask THEN mask tmask firstx:lastx firsty:lasty firstz:lastz end grid U vargrid eq U : begin scalars nx nxu ny nyu firstx firstxu firsty firstyu lastx lastxu lasty lastyu 2d vectors IF arg_present glam THEN glam glamu firstx:lastx firsty:lasty IF arg_present gphi THEN gphi gphiu firstx:lastx firsty:lasty if keyword_set forplt then BEGIN mask 1b tmask firstx:lastx firsty:lasty firstz eastboarder mask shift mask 1 0 mask westboarder mask shift mask 1 0 mask if key_periodic NE 1 OR nx NE jpi then westboarder nx 1 0b tmp1 shift eastboarder 0 1 tmp1 0 0b tmp2 shift eastboarder 0 1 tmp2 ny 1 0b add temporary tmp1 temporary tmp2 1b eastboarder 1b temporary westboarder eastboarder temporary eastboarder temporary add tmp1 mask shift mask 0 1 shift mask 0 1 NE 1b tmp1 ny 1 1b tmp1 0 1b tmp2 mask shift mask 1 0 shift mask 1 0 NE 1b if key_periodic NE 1 OR nx NE jpi then begin tmp2 nx 1 1b tmp2 0 0b endif no1 temporary tmp1 temporary tmp2 tmp temporary eastboarder temporary no1 mask mask 0:nx 2 0b tmp temporary tmp temporary mask tmp where tmp GE 1 if tmp 0 NE 1 then begin glam tmp glamt firstx:lastx firsty:lasty tmp gphi tmp gphit firstx:lastx firsty:lasty tmp endif ENDIF IF arg_present e1 THEN e1 e1u firstx:lastx firsty:lasty IF arg_present e2 THEN e2 e2u firstx:lastx firsty:lasty 3d vectors IF keyword_set forplt THEN mask umask firstx:lastx firsty:lasty firstz ELSE IF arg_present mask THEN mask umask firstx:lastx firsty:lasty firstz:lastz end grid V vargrid eq OPAPTDHV or vargrid eq OPAPT3DV or vargrid eq V : begin scalars nx nxv ny nyv firstx firstxv firsty firstyv lastx lastxv lasty lastyv 2d vectors IF arg_present glam THEN glam glamv firstx:lastx firsty:lasty IF arg_present gphi THEN gphi gphiv firstx:lastx firsty:lasty if keyword_set forplt then BEGIN mask 1b tmask firstx:lastx firsty:lasty firstz northboarder mask shift mask 0 1 mask southboarder mask shift mask 0 1 mask southboarder ny 1 0b tmp1 shift northboarder 1 0 if key_periodic NE 1 OR nx NE jpi then tmp1 nx 1 0b tmp2 shift northboarder 1 0 if key_periodic NE 1 OR nx NE jpi then tmp2 0 0b add temporary tmp1 temporary tmp2 1b northboarder 1b southboarder northboarder temporary northboarder temporary add tmp1 mask shift mask 0 1 shift mask 0 1 NE 1b tmp1 ny 1 1b tmp1 0 0b tmp2 mask shift mask 1 0 shift mask 1 0 NE 1b if key_periodic NE 1 OR nx NE jpi then begin tmp2 nx 1 1b tmp2 0 1b endif no1 temporary tmp1 temporary tmp2 tmp temporary northboarder mask temporary no1 mask 0:ny 2 0b tmp temporary tmp temporary mask tmp where tmp GE 1 if tmp 0 NE 1 then begin glam tmp glamt firstx:lastx firsty:lasty tmp gphi tmp gphit firstx:lastx firsty:lasty tmp endif ENDIF IF arg_present e1 THEN e1 e1v firstx:lastx firsty:lasty IF arg_present e2 THEN e2 e2v firstx:lastx firsty:lasty 3d vecteurs IF keyword_set forplt THEN mask vmask firstx:lastx firsty:lasty firstz ELSE IF arg_present mask THEN mask vmask firstx:lastx firsty:lasty firstz:lastz end grid F vargrid eq OPAPTDHF or vargrid eq OPAPT3DF or vargrid eq F : begin scalars nx nxf ny nyf firstx firstxf firsty firstyf lastx lastxf lasty lastyf 2d vectors IF arg_present glam THEN glam glamf firstx:lastx firsty:lasty IF arg_present gphi THEN gphi gphif firstx:lastx firsty:lasty if keyword_set forplt then BEGIN mask 1b tmask firstx:lastx firsty:lasty firstz eastboarder mask shift mask 1 0 mask westboarder mask shift mask 1 0 mask westboarder nx 1 0b northboarder mask shift mask 0 1 mask southboarder mask shift mask 0 1 mask southboarder ny 1 0b tmp1 shift northboarder 1 0 if key_periodic NE 1 OR nx NE jpi then tmp1 nx 1 0b tmp2 shift northboarder 1 0 if key_periodic NE 1 OR nx NE jpi then tmp2 0 0b add temporary tmp1 temporary tmp2 1b northboarder 1b southboarder northboarder temporary northboarder temporary add tmp1 shift eastboarder 0 1 tmp1 0 0b tmp2 shift eastboarder 0 1 tmp2 ny 1 0b add temporary tmp1 temporary tmp2 1b eastboarder 1b temporary westboarder eastboarder temporary eastboarder temporary add tmp1 mask shift mask 0 1 shift mask 0 1 NE 1b tmp1 ny 1 1b tmp1 0 1b tmp2 mask shift mask 1 0 shift mask 1 0 NE 1b if key_periodic NE 1 OR nx NE jpi then begin tmp2 nx 1 1b tmp2 0 1b endif no1 temporary tmp1 temporary tmp2 tmp temporary northboarder temporary eastboarder mask temporary no1 mask 0:nx 2 0b mask 0:ny 2 0b tmp temporary tmp temporary mask tmp where tmp GE 1 if tmp 0 NE 1 then begin glam tmp glamt firstx:lastx firsty:lasty tmp gphi tmp gphit firstx:lastx firsty:lasty tmp endif ENDIF IF arg_present e1 THEN e1 e1f firstx:lastx firsty:lasty IF arg_present e2 THEN e2 e2f firstx:lastx firsty:lasty 3d vectors IF keyword_set forplt THEN mask fmask firstx:lastx firsty:lasty firstz ELSE IF arg_present mask THEN mask fmask firstx:lastx firsty:lasty firstz:lastz END ELSE:BEGIN ras report Wrong definition of vargrid vargrid Only T U V W or F are acceptable stop END ENDCASE IF testvar var key_performance EQ 2 THEN print temps grille: attribution des scalaires vecteurs et tableaux systime 1 tempdeux Variables refering to the vertical dimension tempdeux systime 1 For key_performance 2 if keyword_set wdepth then begin gdep gdepw firstz:lastz e3 e3w firstz:lastz endif else begin gdep gdept firstz:lastz e3 e3t firstz:lastz ENDELSE for the vertical sections with partial steps IF keyword_set type AND keyword_set key_partialstep THEN BEGIN CASE 1 OF type EQ xz AND ny EQ 1:BEGIN bottom total tmask firstx:lastx firsty:lasty firstz:lastz 3 good where bottom NE 0 AND bottom NE nz keyword_set wdepth bottom lindgen nx bottom 1l keyword_set wdepth nx IF good 0 NE 1 THEN BEGIN bottom bottom good IF lastz EQ jpk 1 THEN gdep nz 1 max hdepw gdep replicate 1 nx gdep if keyword_set wdepth THEN truegdep hdepw firstx:lastx firsty:lasty ELSE truegdep hdept firstx:lastx firsty:lasty gdep bottom truegdep good ENDIF END type EQ yz AND nx EQ 1:BEGIN bottom total tmask firstx:lastx firsty:lasty firstz:lastz 3 good where bottom NE 0 AND bottom NE nz keyword_set wdepth bottom lindgen ny bottom 1l keyword_set wdepth ny IF good 0 NE 1 THEN BEGIN bottom bottom good IF lastz EQ jpk 1 THEN gdep nz 1 max hdepw gdep replicate 1 ny gdep if keyword_set wdepth THEN truegdep hdepw firstx:lastx firsty:lasty ELSE truegdep hdept firstx:lastx firsty:lasty gdep bottom truegdep good ENDIF END ELSE: ENDCASE ENDIF for the vertical sections with roms IF keyword_set type AND n_elements romszinfos NE 0 THEN BEGIN romsdp romsdepth IF romsdp 0 NE 1 THEN BEGIN IF jpt EQ 1 THEN BEGIN CASE type OF z :gdep moyenne temporary romsdp xy xz :gdep moyenne temporary romsdp y yz :gdep moyenne temporary romsdp x zt :gdep moyenne temporary romsdp xy ELSE: ENDCASE ENDIF ELSE BEGIN CASE type OF z :gdep moyenne temporary romsdp xyt xz :gdep grossemoyenne temporary romsdp yt yz :gdep grossemoyenne temporary romsdp xt zt :gdep grossemoyenne temporary romsdp xy ELSE: ENDCASE ENDELSE IF size gdep n_dimensions EQ 2 THEN gdep remplit gdep niter 32000 mask gdep LT 1 E19 basique fillxdir ENDIF ENDIF IF testvar var key_performance EQ 2 THEN print temps grille: Variables se rapportant a la dimension verticale systime 1 tempdeux Triangulation vector when TRI is activated if arg_present TRI then if triangles_list 0 EQ 1 OR keyword_set notri then tri 1 ELSE BEGIN tempdeux systime 1 pour key_performance 2 msk bytarr jpi jpj msk firstx:lastx firsty:lasty 1 ind where msk triangles_list 0 msk triangles_list 1 msk triangles_list 2 EQ 1 tri triangles_list ind firstx firsty jpi y tri jpi x tri y jpi tri x y nx IF testvar var key_performance EQ 2 THEN print temps grille: decoupage de la triangulation systime 1 tempdeux ENDELSE To make sure there is not any degenerated dimension 1 mask reform mask over glam reform glam over gphi reform gphi over gdep reform gdep over e1 reform e1 over e2 reform e2 over e3 reform e3 over if keyword_set savedbox THEN restoreboxparam boxparam4grille dat if keyword_set key_performance THEN print temps grille systime 1 tempsun IF NOT keyword_set key_forgetold THEN BEGIN updateold ENDIF return end "); 210 210 a[208] = new Array("./ToBeReviewed/GRILLE/t2v.html", "t2v.pro", "", " file_comments Allows to pass a field referring to the grid T on the grid V thanks to the average res 0 5 res shift res 0 1 categories Grid param TEMP in required A 2 3 or 4d array returns res a 2 3 or 4d array uses common pro restrictions Force parameters of the zoom on the grid V to be the same as those on the grid T restrictions Points which can not be calculated are put at the value NaN consecrated by IDL: values f_nan history From Marina Levy s programs Sebastien Masson smasson lodyc jussieu fr : Validation 5 6 2000 version Id: t2v pro 163 2006 08 29 12:59:46Z navarro FUNCTION t2v temp compile_opt idl2 strictarrsubs cm_4mesh cm_4data cm_4cal IF NOT keyword_set key_forgetold THEN BEGIN updatenew ENDIF res temp We force nxt nxv etc firstxv firstxt lastxv lastxt firstyv firstyt lastyv lastyt nxv nxt nyv nyt vargrid V if NOT keyword_set valmask then valmask 1e20 lat1 gphit 0 firstyt lat2 gphiv 0 lastyv case on tha array s size and application taille size temp CASE taille 0 OF 1: res 1 2: BEGIN case 1 of taille 1 eq nxt and taille 2 eq nyt: taille 1 eq jpi and taille 2 eq jpj: res res firstxt:lastxt firstyt:lastyt else: return report Probleme d adequation entre les tailles du domaine et de la boite endcase mask tmask firstxt:lastxt firstyt:lastyt 0 terre where mask EQ 0 IF terre 0 NE 1 THEN res terre values f_nan res 0 5 res shift res 0 1 res nyt 1 values f_nan mask vmask firstxt:lastxt firstyt:lastyt 0 terre where mask EQ 0 IF terre 0 NE 1 THEN res terre valmask END 3: BEGIN case 1 of taille 1 eq nxt and taille 2 eq nyt AND taille 3 EQ nzt: taille 1 eq nxt and taille 2 eq nyt AND taille 3 EQ jpk: res res firstzt:lastzt taille 1 eq nxt and taille 2 eq nyt AND taille 3 EQ jpt: taille 1 eq jpi and taille 2 eq jpj AND taille 3 EQ jpk: res res firstxt:lastxt firstyt:lastyt firstzt:lastzt taille 1 eq jpi and taille 2 eq jpj AND taille 3 EQ jpt: res res firstxt:lastxt firstyt:lastyt else: return report Probleme d adequation entre les tailles du domaine et de la boite ENDCASE if taille 3 EQ jpt then begin mask tmask firstxt:lastxt firstyt:lastyt lastzt nzt NE jpk mask temporary mask replicate 1 jpt mask reform mask nxt nyt jpt over ENDIF ELSE mask tmask firstxt:lastxt firstyt:lastyt firstzt:lastzt terre where temporary mask EQ 0 IF terre 0 NE 1 THEN res temporary terre values f_nan res 0 5 res shift res 0 1 0 res nyt 1 values f_nan if taille 3 EQ jpt then BEGIN mask vmask firstxt:lastxt firstyt:lastyt lastzt nzt NE jpk mask temporary mask replicate 1 jpt mask reform mask nxt nyt jpt over ENDIF ELSE mask vmask firstxt:lastxt firstyt:lastyt firstzt:lastzt terre where temporary mask EQ 0 IF terre 0 NE 1 THEN res temporary terre valmask END 4: BEGIN case 1 of taille 1 eq nxt and taille 2 eq nyt AND taille 3 EQ nzt AND taille 4 EQ jpt: taille 1 eq nxt and taille 2 eq nyt AND taille 3 EQ jpk AND taille 4 EQ jpt: res res firstzt:lastzt taille 1 eq jpi and taille 2 eq jpj AND taille 3 EQ jpk AND taille 4 EQ jpt: res res firstxt:lastxt firstyt:lastyt firstzt:lastzt else: return report Probleme d adequation entre les tailles du domaine et de la boite ENDCASE mask tmask firstxt:lastxt firstyt:lastyt firstzt:lastzt mask temporary mask replicate 1 jpt mask reform mask nxt nyt nzt jpt over terre where temporary mask EQ 0 IF terre 0 NE 1 THEN res temporary terre values f_nan res 0 5 res shift res 0 1 0 0 res nyt 1 values f_nan mask vmask firstxt:lastxt firstyt:lastyt firstzt:lastzt mask temporary mask replicate 1 jpt mask reform mask nxt nyt nzt jpt over terre where temporary mask EQ 0 IF terre 0 NE 1 THEN res temporary terre valmask END ENDCASE IF NOT keyword_set key_forgetold THEN BEGIN updateold ENDIF return res END "); 211 a[209] = new Array("./ToBeReviewed/GRILLE/tracegrille.html", "tracegrille.pro", "", " file_comments Draw the grid categories param GLAMIN in required The 1d or 2d array in longitude of points of the grid If GLAM GLAMIN is not specified it trace the grid specified by vargrid on the domain defined by domdef param GPHIIN in required The 1d or 2d array in latitude of points of the grid If GPHI GPHIIN is not specified it trace the grid specified by vargrid on the domain defined by domdef keyword XSTRIDE type integer It specify that we want to trace only one line of constant i every xstride points keyword YSTRIDE type integer It specify that we want to trace only one line of constant j every xstride points keyword OCEAN To trace the grid only on ocean points keyword EARTH To trace the grid only on land points keyword RMOUT Select to remove all cell having one corner out of the plot boundaries x range y range keyword _EXTRA Used to pass your keywords uses common pro examples IDL plt indgen jpi jpj nocontour nofill IDL vargrid T IDL tracegrille ocean color 20 IDL tracegrille earth color 80 history Sebastien Masson smasson lodyc jussieu fr version Id: tracegrille pro 163 2006 08 29 12:59:46Z navarro PRO tracegrille glamin gphiin OCEAN ocean EARTH earth XSTRIDE xstride YSTRIDE ystride RMOUT rmout _extra extra compile_opt idl2 strictarrsubs cm_4mesh cm_4data IF NOT keyword_set key_forgetold THEN BEGIN updatenew ENDIF tempsun systime 1 For key_performance to avoid warning message oldexcept except except 0 if n_elements key_gridtype EQ 0 then key_gridtype c if n_elements glamin n_elements gphiin EQ 0 then BEGIN grille mask glam gphi gdep nx ny nz firstx firsty firstz lastx lasty lastz IF keyword_set ocean AND key_gridtype EQ c THEN BEGIN we reduce the mask to take into account the point located ON the coastline CASE vargrid OF U :BEGIN mask tmask firstx:lastx firsty:lasty IF NOT keyword_set key_periodic OR nx NE jpi THEN tmpx mask nx 1 mask mask shift mask 1 0 1 IF NOT keyword_set key_periodic OR nx NE jpi THEN mask nx 1 temporary tmpx END V :BEGIN mask tmask firstx:lastx firsty:lasty tmpy mask ny 1 mask mask shift mask 0 1 1 mask ny 1 temporary tmpy END F :BEGIN mask tmask firstx:lastx firsty:lasty IF NOT keyword_set key_periodic OR nx NE jpi THEN tmpx mask nx 1 tmpy mask ny 1 mask mask shift mask 1 0 shift mask 0 1 shift mask 1 1 1 mask ny 1 temporary tmpy IF NOT keyword_set key_periodic OR nx NE jpi THEN mask nx 1 temporary tmpx END ELSE: ENDCASE ENDIF ENDIF ELSE BEGIN glam glamin gphi gphiin IF size glam 0 EQ 1 AND size gphi 0 EQ 1 THEN BEGIN nx n_elements glam ny n_elements gphi glam glam replicate 1 ny gphi replicate 1 nx gphi ENDIF ELSE BEGIN nx size glam 1 ny size glam 2 ENDELSE ENDELSE if n_elements mask EQ 0 then mask replicate 1b nx ny if size mask 0 EQ 3 then mask mask 0 IF keyword_set RMOUT THEN BEGIN out where glam GT max x range OR glam LT min x range OR gphi GT max y range OR gphi LT min y range IF out 0 NE 1 THEN BEGIN glam out values f_nan gphi out values f_nan ENDIF ENDIF IF keyword_set ocean then BEGIN earth where mask EQ 0 if earth 0 NE 1 then begin glam earth values f_nan gphi earth values f_nan ENDIF earth 0 ENDIF IF keyword_set earth THEN BEGIN ocean where mask EQ 1 if ocean 0 NE 1 then begin glam ocean values f_nan gphi ocean values f_nan ENDIF ocean 0 ENDIF if NOT keyword_set xstride then xstride 1 if NOT keyword_set ystride then ystride 1 case key_gridtypeof c :BEGIN for i 0 ny 1 ystride do begin plots glam i gphi i _extra extra endfor for i 0 nx 1 xstride do begin plots glam i gphi i _extra extra endfor END e :BEGIN shifted glam 0 0 LT glam 0 1 glam2 glam glam 1 glam 0 2 if shifted then begin for i 0 ny 2 do BEGIN xx transpose glam i glam2 i yy transpose gphi i gphi i 1 plots xx 0:2 nx 2 yy 0:2 nx 2 _extra extra ENDFOR ENDIF ELSE BEGIN for i 1 ny 1 do BEGIN xx transpose glam i glam2 i yy transpose gphi i gphi i 1 plots xx 0:2 nx 2 yy 0:2 nx 2 _extra extra ENDFOR ENDELSE for i 1 ny 1 2 do plots glam 0 2 i 1 glam 0 2 i gphi 0 2 i 1 gphi 0 2 i _extra extra for i 0 ny 2 2 do plots glam nx 1 2 i glam nx 1 2 i 1 gphi nx 1 2 i gphi nx 1 2 i 1 _extra extra END endcase if keyword_set key_performance THEN print temps trace grille systime 1 tempsun except oldexcept return end");211 a[209] = new Array("./ToBeReviewed/GRILLE/tracegrille.html", "tracegrille.pro", "", " file_comments Draw the grid categories param GLAMIN in required The 1d or 2d array in longitude of points of the grid If GLAM GLAMIN is not specified it trace the grid specified by vargrid on the domain defined by domdef param GPHIIN in required The 1d or 2d array in latitude of points of the grid If GPHI GPHIIN is not specified it trace the grid specified by vargrid on the domain defined by domdef keyword XSTRIDE type integer It specify that we want to trace only one line of constant i every xstride points keyword YSTRIDE type integer It specify that we want to trace only one line of constant j every xstride points keyword OCEAN To trace the grid only on ocean points keyword EARTH To trace the grid only on land points keyword RMOUT Select to remove all cell having one corner out of the plot boundaries x range y range keyword _EXTRA Used to pass your keywords uses common pro examples IDL plt indgen jpi jpj nocontour nofill IDL vargrid T IDL tracegrille ocean color 20 IDL tracegrille earth color 80 history Sebastien Masson smasson lodyc jussieu fr version Id: tracegrille pro 209 2007 02 08 10:01:49Z smasson PRO tracegrille glamin gphiin OCEAN ocean EARTH earth XSTRIDE xstride YSTRIDE ystride RMOUT rmout _extra extra compile_opt idl2 strictarrsubs cm_4mesh cm_4data IF NOT keyword_set key_forgetold THEN BEGIN updatenew ENDIF tempsun systime 1 For key_performance to avoid warning message oldexcept except except 0 if n_elements key_gridtype EQ 0 then key_gridtype c if n_elements glamin n_elements gphiin EQ 0 then BEGIN grille mask glam gphi gdep nx ny nz firstx firsty firstz lastx lasty lastz IF keyword_set ocean AND strmid key_gridtype 0 1 EQ c THEN BEGIN we reduce the mask to take into account the point located ON the coastline CASE vargrid OF U :BEGIN mask tmask firstx:lastx firsty:lasty IF NOT keyword_set key_periodic OR nx NE jpi THEN tmpx mask nx 1 mask mask shift mask 1 0 1 IF NOT keyword_set key_periodic OR nx NE jpi THEN mask nx 1 temporary tmpx END V :BEGIN mask tmask firstx:lastx firsty:lasty tmpy mask ny 1 mask mask shift mask 0 1 1 mask ny 1 temporary tmpy END F :BEGIN mask tmask firstx:lastx firsty:lasty IF NOT keyword_set key_periodic OR nx NE jpi THEN tmpx mask nx 1 tmpy mask ny 1 mask mask shift mask 1 0 shift mask 0 1 shift mask 1 1 1 mask ny 1 temporary tmpy IF NOT keyword_set key_periodic OR nx NE jpi THEN mask nx 1 temporary tmpx END ELSE: ENDCASE ENDIF ENDIF ELSE BEGIN glam glamin gphi gphiin IF size glam 0 EQ 1 AND size gphi 0 EQ 1 THEN BEGIN nx n_elements glam ny n_elements gphi glam glam replicate 1 ny gphi replicate 1 nx gphi ENDIF ELSE BEGIN nx size glam 1 ny size glam 2 ENDELSE ENDELSE if n_elements mask EQ 0 then mask replicate 1b nx ny if size mask 0 EQ 3 then mask mask 0 IF keyword_set RMOUT THEN BEGIN out where glam GT max x range OR glam LT min x range OR gphi GT max y range OR gphi LT min y range IF out 0 NE 1 THEN BEGIN glam out values f_nan gphi out values f_nan ENDIF ENDIF IF keyword_set ocean then BEGIN earth where mask EQ 0 if earth 0 NE 1 then begin glam earth values f_nan gphi earth values f_nan ENDIF earth 0 ENDIF IF keyword_set earth THEN BEGIN ocean where mask EQ 1 if ocean 0 NE 1 then begin glam ocean values f_nan gphi ocean values f_nan ENDIF ocean 0 ENDIF if NOT keyword_set xstride then xstride 1 if NOT keyword_set ystride then ystride 1 case strmid key_gridtype 0 1 of c :BEGIN for i 0 ny 1 ystride do begin plots glam i gphi i _extra extra endfor for i 0 nx 1 xstride do begin plots glam i gphi i _extra extra endfor END e :BEGIN shifted glam 0 0 LT glam 0 1 glam2 glam glam 1 glam 0 2 if shifted then begin for i 0 ny 2 do BEGIN xx transpose glam i glam2 i yy transpose gphi i gphi i 1 plots xx 0:2 nx 2 yy 0:2 nx 2 _extra extra ENDFOR ENDIF ELSE BEGIN for i 1 ny 1 do BEGIN xx transpose glam i glam2 i yy transpose gphi i gphi i 1 plots xx 0:2 nx 2 yy 0:2 nx 2 _extra extra ENDFOR ENDELSE for i 1 ny 1 2 do plots glam 0 2 i 1 glam 0 2 i gphi 0 2 i 1 gphi 0 2 i _extra extra for i 0 ny 2 2 do plots glam nx 1 2 i glam nx 1 2 i 1 gphi nx 1 2 i gphi nx 1 2 i 1 _extra extra END endcase if keyword_set key_performance THEN print temps trace grille systime 1 tempsun except oldexcept return end"); 212 212 a[210] = new Array("./ToBeReviewed/GRILLE/u2t.html", "u2t.pro", "", " file_comments Allows to pass a field referring to the grid U on the grid T thanks to the average: res 0 5 res shift res 1 0 categories Grid param TEMP in required A 2 3 or 4d array returns res a 2 3 or 4d array uses common pro restrictions Force parameters of the zoom on the grid V to be the same as those on the grid T restrictions Points which can not be calculated are put at the value NaN consecrated by IDL: values f_nan history From Marina Levy s programs Sebastien Masson smasson lodyc jussieu fr : Validation 5 6 2000 version Id: u2t pro 163 2006 08 29 12:59:46Z navarro FUNCTION u2t temp compile_opt idl2 strictarrsubs cm_4mesh cm_4data cm_4cal IF NOT keyword_set key_forgetold THEN BEGIN updatenew ENDIF res temp on force nxt nxu etc firstxt firstxu lastxt lastxu firstyt firstyu lastyt lastyu nxt nxu nyt nyu vargrid T if NOT keyword_set valmask then valmask 1e20 lon1 glamt firstxt 0 lon2 glamu lastxu 0 case on tha array s size and application taille size temp CASE taille 0 OF 1: res 1 2: BEGIN case 1 of taille 1 eq nxu and taille 2 eq nyu: taille 1 eq jpi and taille 2 eq jpj: res res firstxu:lastxu firstyu:lastyu else: return report Probleme d adequation entre les tailles du domaine et de la boite endcase mask umask firstxu:lastxu firstyu:lastyu 0 terre where mask EQ 0 IF terre 0 NE 1 THEN res terre values f_nan res 0 5 res shift res 1 0 if NOT keyword_set key_periodic AND nxu EQ jpi then res 0 values f_nan mask tmask firstxu:lastxu firstyu:lastyu 0 terre where mask EQ 0 IF terre 0 NE 1 THEN res terre valmask END 3: BEGIN case 1 of taille 1 eq nxu and taille 2 eq nyu AND taille 3 EQ nzt: taille 1 eq nxu and taille 2 eq nyu AND taille 3 EQ jpk: res res firstzt:lastzt taille 1 eq nxu and taille 2 eq nyu AND taille 3 EQ jpt: taille 1 eq jpi and taille 2 eq jpj AND taille 3 EQ jpk: res res firstxu:lastxu firstyu:lastyu firstzt:lastzt taille 1 eq jpi and taille 2 eq jpj AND taille 3 EQ jpt: res res firstxu:lastxu firstyu:lastyu else: return report Probleme d adequation entre les tailles du domaine et de la boite ENDCASE if taille 3 EQ jpt then begin mask umask firstxu:lastxu firstyu:lastyu lastzt nzt NE jpk mask temporary mask replicate 1 jpt mask reform mask nxu nyu jpt over ENDIF ELSE mask umask firstxu:lastxu firstyu:lastyu firstzt:lastzt terre where temporary mask EQ 0 IF terre 0 NE 1 THEN res temporary terre values f_nan res 0 5 res shift res 1 0 0 if NOT keyword_set key_periodic AND nxu EQ jpi then res 0 values f_nan if taille 3 EQ jpt then BEGIN mask tmask firstxu:lastxu firstyu:lastyu lastzt nzt NE jpk mask temporary mask replicate 1 jpt mask reform mask nxu nyu jpt over ENDIF ELSE mask tmask firstxu:lastxu firstyu:lastyu firstzt:lastzt terre where temporary mask EQ 0 IF terre 0 NE 1 THEN res temporary terre valmask END 4: BEGIN case 1 of taille 1 eq nxu and taille 2 eq nyu AND taille 3 EQ nzt AND taille 4 EQ jpt: taille 1 eq nxu and taille 2 eq nyu AND taille 3 EQ jpk AND taille 4 EQ jpt: res res firstzt:lastzt taille 1 eq jpi and taille 2 eq jpj AND taille 3 EQ jpk AND taille 4 EQ jpt: res res firstxu:lastxu firstyu:lastyu firstzt:lastzt else: return report Probleme d adequation entre les tailles du domaine et de la boite ENDCASE mask umask firstxu:lastxu firstyu:lastyu firstzt:lastzt mask temporary mask replicate 1 jpt mask reform mask nxu nyu nzt jpt over terre where temporary mask EQ 0 IF terre 0 NE 1 THEN res temporary terre values f_nan res 0 5 res shift res 1 0 0 0 if NOT keyword_set key_periodic AND nxu EQ jpi then res 0 values f_nan mask tmask firstxu:lastxu firstyu:lastyu firstzt:lastzt mask temporary mask replicate 1 jpt mask reform mask nxu nyu nzt jpt over terre where temporary mask EQ 0 IF terre 0 NE 1 THEN res temporary terre valmask END endcase IF NOT keyword_set key_forgetold THEN BEGIN updateold ENDIF return res END "); 213 213 a[211] = new Array("./ToBeReviewed/GRILLE/umask.html", "umask.pro", "", " file_comments calculate umask Economize memory we do not need to keep umask anymore categories Utilities returns A 3d array corresponding to umask uses common pro examples Used like if umask was a known array by substituing umask by umask For example: Instaed of write umask domainef we have to write umask domainef MODIFICATION HISTORY: Sebastien Masson smasson lodyc jussieu fr 11 12 98 6 99 introduction of the key_shift 20 9 99 cas jpk 1 Thanks to jpblod ipsl jussieu fr version Id: umask pro 157 2006 08 21 09:01:50Z navarro FUNCTION umask compile_opt idl2 strictarrsubs cm_4mesh IF NOT keyword_set key_forgetold THEN BEGIN updatenew ENDIF tempsun systime 1 For key_performance CASE size tmask n_dimensions OF 2:res tmask shift tmask 1 0 3:res tmask shift tmask 1 0 0 ENDCASE if NOT keyword_set key_periodic then res jpi 1 umaskred if keyword_set key_performance THEN print temps umask systime 1 tempsun return res end"); … … 249 249 a[247] = new Array("./ToBeReviewed/LECTURE/ncdf_lec.html", "ncdf_lec.pro", "", " file_comments Give informations on a file net cdf and allows to recuperate variables which are write in categories Reading param NOM in required Name of a file net cdf situated in the directory stipulated by iodir keyword ATT global or at the name of a variable Allows to see all attributes joined at a variable keyword DIM Give the list of dimensions keyword VAR 1 var: Gove the list of dimensions 2 var nom de variable : in this case the function send back the variable keyword IODIR String containing the directory containing the file to be read keyword _EXTRA Allows to pass keywords defined by IDL to functions NETCDF particularly OFFSET and COUNT in ncdf_varget returns 1 except if var nom de variable then the function send back the variable restrictions Variables s names of the program are similar to these used by the IDL manual scientific data formats history Sebastien Masson smasson lodyc jussieu fr 4 1 98 version Id: ncdf_lec pro 163 2006 08 29 12:59:46Z navarro function ncdf_lec nom ATT att DIM dim VAR var IODIR iodir _extra ex compile_opt idl2 strictarrsubs res 1 if NOT keyword_set IODIR then iodir if not keyword_set att or keyword_set dim or keyword_set var then BEGIN att 1 dim 1 var 1 commande ncdump c iodir nom spawn commande goto fini endif opening of the file name cdfid ncdf_open iodir nom Wht does the file contain wathinside ncdf_inquire cdfid print in the file iodir nom there are: if keyword_set dim then begin print nombre de dimensions: strtrim wathinside ndims 1 print numero de la dimension dont la valeur est infini: strtrim wathinside recdim 1 endif if keyword_set var then if size var type NE 7 then print nombre de variables : strtrim wathinside nvars 1 if keyword_set att then begin if strlowcase att ne global then goto nonglobal print nombre de attributs globaux : strtrim wathinside ngatts 1 endif Global attributes if keyword_set att then begin print print ATTRIBUTS GLOBAUX for attiq 0 wathinside ngatts 1 do begin name ncdf_attname cdfid attiq global attribute s name ncdf_attget cdfid name value global attribute s value print name : string value endfor endif nonglobal: Display of different dimensions if keyword_set dim then begin print print DIMENSIONS endif nomdim strarr wathinside ndims tailledim lonarr wathinside ndims for dimiq 0 wathinside ndims 1 do begin ncdf_diminq cdfid dimiq name value dimension s name and value nomdim dimiq name tailledim dimiq value if keyword_set dim then begin print dimension numero strtrim dimiq 1 nom: nomdim dimiq valeur: strtrim tailledim dimiq 1 endif endfor Display of different variables if keyword_set att or keyword_set var then begin var s value string or 1 help var output nature if strpos nature STRING 0 NE 1 then nature string ELSE nature 1 If we just have to read the variable if nature EQ string then begin ncdf_varget cdfid var res _extra ex GOTO sortie ENDIF If it is to have pieces of information if not keyword_set att then att rien print for varid 0 wathinside nvars 1 do begin varcontent ncdf_varinq cdfid varid What does variable contain if strlowcase att eq strlowcase varcontent name or keyword_set var then begin print variable numero: strtrim varid 1 nom: varcontent name type: varcontent datatype dimensions: nomdim varcontent dim if strlowcase att eq strlowcase varcontent name then begin for attiq 0 varcontent natts 1 do begin name ncdf_attname cdfid varid attiq ncdf_attget cdfid varid name value print strtrim attiq name : strtrim string value 1 endfor goto sortie endif endif endfor endif sortie: ncdf_close cdfid fini: return res end"); 250 250 a[248] = new Array("./ToBeReviewed/LECTURE/read_ftp.html", "read_ftp.pro", "", " file_comments categories param U param CMD param RES keyword OUT keyword COUNT Upon return the number of elements in the result set This is only important when the result set is the empty set in which case COUNT is set to zero restrictions examples history version Id: read_ftp pro 157 2006 08 21 09:01:50Z navarro pro ftp_post u cmd res out out count count compile_opt idl2 if cmd ne then begin printf u cmd format a comment out the following line to disable debug info print cmd endif if size out type eq 0 then out 2 catch err if err ne 0 then return line count 0 while arg_present res do begin readf u line if count eq 0 then res line else res res line count count 1 comment out the following line to disable debug info print READ_FTP ftp: ftp rsinc com pub gzip README GZIP DATA data IDL help data DATA BYTE Array 2134 IDL print string data README file: Research Systems Anonymous FTP site ftp rsinc com pub directory gzip directory 2 Retrieve some files from podaac jpl nasa gov and store the files in the current working directory: IDL files string lindgen 10 50 format MGB370 3 3d gz IDL READ_FTP podaac jpl nasa gov files IDL pub sea_surface_height topex_poseidon mgdrb data MGB_370 FILE IDL spawn dir MGB log_output Volume in drive C is Local Disk Volume Serial Number is 34CE 24DF Directory of C: test test0307 07 28 2003 11:58a 362 167 MGB370 050 gz 07 28 2003 11:58a 333 005 MGB370 051 gz 07 28 2003 11:58a 310 287 MGB370 052 gz 07 28 2003 11:58a 358 771 MGB370 053 gz 07 28 2003 11:59a 387 282 MGB370 054 gz 07 28 2003 11:59a 361 633 MGB370 055 gz 07 28 2003 11:59a 383 075 MGB370 056 gz 07 28 2003 11:59a 365 844 MGB370 057 gz 07 28 2003 11:59a 383 918 MGB370 058 gz 07 28 2003 12:00p 372 712 MGB370 059 gz 10 File s 3 618 694 bytes These compressed files can cosequently be opened with OPENR and the COMPRESSED keyword history version Id: read_ftp pro 157 2006 08 21 09:01:50Z navarro todo seb: que fait on de syntax au debut du header give examples with date in year 0 should not exists but may happen pro read_ftp site files dir port data data file file user user pass pass ptr ptr compile_opt idl2 if n_elements port eq 0 then port ftp if n_elements files eq 0 then begin if strcmp site ftp: 6 then host strmid site 6 else host site pos strpos host dir strmid host pos host strmid host 0 pos pos strpos dir reverse_search files strmid dir pos 1 dir strmid dir 0 pos endif else host site if size user type eq 0 then user anonymous if size pass type eq 0 then pass test test com socket u host port connect_timeout 5 read_timeout 5 get_lun ftp_post u res ftp_post u USER user res out 3 ftp_post u PASS pass res ftp_post u TYPE I res if size dir type ne 0 then ftp_post u CWD dir res if keyword_set file or arg_present data then begin bufsize 512 buffer bytarr bufsize n n_elements files if arg_present data then dat ptrarr n for i 0 n 1 do begin ftp_post u SIZE files i res out 213 sz long64 strmid res n_elements res 1 4 if arg_present data then dat i ptr_new bytarr sz ftp_post u PASV res ftp_parse_pasv res host port ftp_post u RETR files i res out 1 socket v host port connect_timeout 5 read_timeout 5 get_lun rawio tc 0ll if keyword_set file then openw w files i get_lun while tc lt sz do begin if sz tc lt bufsize then begin bufsize sz tc buffer bytarr bufsize endif readu v buffer transfer_count dtc if arg_present data then dat i tc dtc eq bufsize buffer:buffer 0:dtc 1 if keyword_set file then writeu w dtc eq bufsize buffer:buffer 0:dtc 1 tc tc dtc endwhile free_lun v if keyword_set file then free_lun w ftp_post u res endfor if arg_present data then begin if n gt 1 or keyword_set ptr then data dat else data temporary dat 0 endif endif ftp_post u QUIT res free_lun u end"); 251 a[249] = new Array("./ToBeReviewed/LECTURE/read_ncdf.html", "read_ncdf.pro", "", " file_comments Reading function for the file net_cdf This program is less universal than ncdf_lec it appeal to declared variables in common pro but it is very easier to be used It considerate the declaration of the different zooms which have been defined ixminmesh premierx the declaration of the variable key_shift To put it in a nutshell the result of read_ncdf can be directly used in plt This is also this program which is used by default in our reading widgets categories Reading param NAME in required type string It define the field to be read param BEGINNING in required Relative with the time axis These can be 2 date of the type yyyymmdd and in this case we select dates which are included between these two dates 2 indexes which define between which and which time step we have to extract the temporal dimension param ENDING in required Relative with the time axis See BEGINNING param COMPATIBILITY in optional Useless defined for compatibility keyword BOXZOOM Contain the boxzoom on which we have to do the reading keyword CALLITSELF default 0 type scalar: 0 or 1 For ROMS outputs Use by read_ncdf itself to access auxilliary data h and zeta keyword FILENAME required type string It contains he file s name keyword INIT default 0 type scalar: 0 or 1 To call automatically initncdf filename and thus redefine all the grid parameters keyword GRID UTVWF to specify the type of grid Default is 1 based on the name of the file if the file ends by GRID _ TUVFW NC not case sensible or 2 T if case 1 is not found keyword TIMESTEP default 0 type scalar: 0 or 1 Specify that BEGINNING and ENDING refer to indexes of the time axis and not to dates keyword TOUT default 0 type scalar: 0 or 1 We activate it if we want to read the file on the whole domain without considerate the sub domain defined by the boxzoom or lon1 lon2 lat1 lat2 vert1 vert2 keyword NOSTRUCT default 0 type scalar: 0 or 1 We activate it if we do not want that read_ncdf send back a structure but only the array referring to the field keyword TIMEVAR type string It define the name of the variable that contains the time axis This keyword can be useful if there is no unlimited dimension or if the time axis selected by default the first 1D array with unlimited dimension is not the good one keyword ZETAFILENAME default FILENAME type string For ROMS outputs The filename of the file where zeta vriable should be read keyword ZETAZERO default 0 type scalar: 0 or 1 For ROMS outputs To define zeta to 0 instead of reading it keyword _EXTRA Used to pass your keywords returns Structure readable by litchamp pro or an array if NOSTRUCT is activated uses common pro restrictions The field must have a temporal dimension history Sebastien Masson smasson lodyc jussieu fr 15 10 1999 version Id: read_ncdf pro 199 2006 12 13 07:47:14Z smasson FUNCTION read_ncdf name beginning ending compatibility BOXZOOM boxzoom FILENAME filename PARENTIN parentin TIMESTEP timestep TIMEVAR timevar TOUT tout NOSTRUCT nostruct CONT_NOFILL CONT_NOFILL INIT init GRID grid FBASE2TBASE fbase2tbase CALLITSELF callitself ZETAFILENAME zetafilename ZETAZERO zetazero _EXTRA ex compile_opt idl2 strictarrsubs cm_4mesh cm_4data cm_4cal IF NOT keyword_set key_forgetold THEN BEGIN updatenew updatekwd ENDIF we find the filename print filename is parent a valid widget if keyword_set parentin then BEGIN parent long parentin parent parent widget_info parent managed ENDIF filename isafile filename filename IODIRECTORY iodir _EXTRA ex Opening of the name file if size filename type NE 7 then return report read_ncdf cancelled IF version OS_FAMILY EQ unix THEN spawn file filename dev null cdfid ncdf_open filename contient ncdf_inquire cdfid we check if the variable name exists in the file if ncdf_varid cdfid name EQ 1 then BEGIN ncdf_close cdfid return report variable name C not found in the file filename ENDIF varcontient ncdf_varinq cdfid name IF varcontient ndims LT 2 THEN return report read_ncdf cannot read scalar or 1D data look for the dimension names dimnames strarr varcontient ndims FOR i 0 varcontient ndims 1 DO BEGIN ncdf_diminq cdfid varcontient dim i tmp dimsize dimnames i tmp ENDFOR shall we redefine the grid parameters if keyword_set init THEN initncdf filename _extra ex check the time axis and the debut and ending dates if n_elements beginning EQ 0 then begin beginning 0 timestep 1 endif if keyword_set timestep then begin firsttps beginning 0 if n_elements ending NE 0 then lasttps ending 0 ELSE lasttps firsttps jpt lasttps firsttps 1 IF NOT keyword_set callitself then time julday 1 1 1 lindgen jpt ENDIF ELSE BEGIN if keyword_set parent then BEGIN widget_control parent get_uvalue top_uvalue filelist extractatt top_uvalue filelist IF filelist 0 EQ many THEN filelist filename currentfile where filelist EQ filename 0 time extractatt top_uvalue fileparameters currentfile time_counter date1 date2jul beginning 0 if n_elements ending NE 0 then date2 date2jul ending 0 ELSE date2 date1 firsttps where time EQ date1 firsttps firsttps 0 lasttps where time EQ date2 lasttps lasttps 0 ENDIF ELSE BEGIN IF keyword_set timevar THEN BEGIN timeid ncdf_varid cdfid timevar IF timeid EQ 1 THEN BEGIN ncdf_close cdfid return report the file filename as no variable timevar C Use the TIMESTEP keyword endif timecontient ncdf_varinq cdfid timeid contient recdim timecontient dim 0 ENDIF ELSE BEGIN we find the infinite dimension timedim contient recdim if timedim EQ 1 then BEGIN ncdf_close cdfid return report the file filename as no infinite dimension C Use TIMESTEP or TIMEVAR keyword endif we find the FIRST time axis timeid 0 repeat BEGIN As long as we have not find a variable having only one dimension: the infinite one timecontient ncdf_varinq cdfid timeid that the variable contain timeid timeid 1 endrep until n_elements timecontient dim EQ 1 AND timecontient dim 0 EQ contient recdim OR timeid EQ contient nvars 1 if timeid EQ contient nvars 1 then BEGIN ncdf_close cdfid return report the file filename as no time axis variable C Use the TIMESTEP keyword endif timeid timeid 1 ENDELSE we must found the time origin of the julian calendar used in the time axis does the attribut units an dcalendar exist for the variable time axis if timecontient natts EQ 0 then BEGIN ncdf_close cdfid return report the variable timecontient name has no attribut C Use the TIMESTEP keyword or add the attribut units to the variable endif attnames strarr timecontient natts for attiq 0 timecontient natts 1 do attnames attiq ncdf_attname cdfid timeid attiq if where attnames EQ units 0 EQ 1 then BEGIN ncdf_close cdfid return report Attribut units not found for the variable timecontient name C Use the TIMESTEP keyword ENDIF now we try to find the attribut called calendar the attribute calendar exists If no we suppose that the calendar is gregorian calendar if where attnames EQ calendar 0 NE 1 then BEGIN ncdf_attget cdfid timeid calendar value value string value CASE value OF noleap :key_caltype noleap 360d :key_caltype 360d greg :IF n_elements key_caltype EQ 0 THEN key_caltype greg ELSE:BEGIN notused report Unknown calendar: value we use greg calendar key_caltype greg END ENDCASE ENDIF ELSE BEGIN notused report Unknown calendar we use key_caltype calendar IF n_elements key_caltype EQ 0 THEN key_caltype greg ENDELSE now we take acre of units attribut ncdf_attget cdfid timeid units value time_counter:units seconds since 0001 01 01 00:00:00 time_counter:units hours since 0001 01 01 00:00:00 time_counter:units days since 1979 01 01 00:00:00 time_counter:units months since 1979 01 01 00:00:00 time_counter:units years since 1979 01 01 00:00:00 we decript the units attribut to find the time origin value strtrim strcompress string value 2 mots str_sep value unite mots 0 unite strlowcase unite IF strpos unite s strlen unite 1 NE 1 THEN unite strmid unite 0 strlen unite 1 IF strpos unite julian_ NE 1 THEN unite strmid unite 7 IF unite NE second AND unite NE hour AND unite NE day AND unite NE month AND unite NE year THEN BEGIN ncdf_close cdfid return report time units does not start with seconds hours days months years ENDIF IF stregex value since 0 9 1 4 0 9 1 2 0 9 1 2 boolean EQ 0 THEN BEGIN ncdf_close cdfid return report attribut units of time has not the good format: since 0 9 1 4 0 9 1 2 0 9 1 2 ENDIF depart str_sep mots 2 ncdf_varget cdfid timeid time time double time case unite of second :time julday depart 1 depart 2 depart 0 time 86400 d hour :time julday depart 1 depart 2 depart 0 time 24 d day :time julday depart 1 depart 2 depart 0 time month :BEGIN if total fix time NE time NE 0 then we switch to days with 30d m time julday depart 1 depart 2 depart 0 round time 30 ELSE for t 0 n_elements time 1 DO time t julday depart 1 time t depart 2 depart 0 END year :BEGIN if total fix time NE time NE 0 then we switch to days with 365d y time julday depart 1 depart 2 depart 0 round time 365 ELSE for t 0 n_elements time 1 do time t julday depart 1 depart 2 depart 0 time t END ELSE:BEGIN ncdf_close cdfid return report The units attribute of the time axis must be something like: C seconds since 0001 01 01 C days since 1979 01 01 C months since 1979 01 01 C years since 1979 01 01 end ENDCASE date1 date2jul beginning 0 if n_elements ending NE 0 then date2 date2jul ending 0 ELSE date2 date1 time double time firsttps where time GE date1 firsttps firsttps 0 if firsttps EQ 1 THEN BEGIN ncdf_close cdfid return report date 1: strtrim jul2date date1 1 is not found in the time axis ENDIF lasttps where time LE date2 if lasttps 0 EQ 1 THEN BEGIN ncdf_close cdfid return report the time axis has no date before date 2: strtrim jul2date date2 1 endif lasttps lasttps n_elements lasttps 1 if lasttps LT firsttps then BEGIN ncdf_close cdfid return report the time axis has no dates between date1 and date 2: strtrim jul2date date1 1 strtrim jul2date date2 1 endif ENDELSE time time firsttps:lasttps jpt lasttps firsttps 1 ENDELSE Name of the grid on which the field refer to IF keyword_set grid THEN vargrid strupcase grid ELSE BEGIN vargrid T default definition IF finite glamu 0 EQ 1 THEN BEGIN are we in one of the case corresponding to ROMS conventions CASE 1 OF dimnames 2 long key_stride key_shift long testvar var key_shift IF n_elements key_yreverse EQ 0 THEN key_yreverse 0 IF keyword_set key_yreverse THEN BEGIN tmp jpj 1 firsty firsty jpj 1 lasty lasty tmp ENDIF IF n_elements key_zreverse EQ 0 THEN key_zreverse 0 IF keyword_set key_zreverse THEN BEGIN tmp jpk 1 firstz firstz jpk 1 lastz lastz tmp ENDIF IF keyword_set fbase2tbase THEN BEGIN case strupcase vargrid of U :BEGIN IF NOT keyword_set key_periodic THEN BEGIN firstx firstx 1 lastx lastx 1 ENDIF END V :BEGIN firsty firsty 1 lasty lasty 1 END F :BEGIN firsty firsty 1 lasty lasty 1 IF NOT keyword_set key_periodic THEN BEGIN firstx firstx 1 lastx lastx 1 ENDIF END ELSE: endcase ENDIF IF keyword_set fbase2tbase AND keyword_set key_periodic AND strupcase vargrid EQ U OR strupcase vargrid EQ F THEN key_shift key_shift 1 read_ncdf_varget IF keyword_set fbase2tbase AND keyword_set key_periodic AND strupcase vargrid EQ U OR strupcase vargrid EQ F THEN key_shift key_shift 1 We define global variable joined with the variable varname IF NOT keyword_set callitself THEN varname name varunit if varcontient natts NE 0 then begin attnames strarr varcontient natts for attiq 0 varcontient natts 1 do attnames attiq ncdf_attname cdfid name attiq lowattnames strlowcase attnames found where lowattnames EQ units 0 IF found NE 1 then ncdf_attget cdfid name attnames found value ELSE value IF NOT keyword_set callitself THEN varunit strtrim string value 2 found where lowattnames EQ add_offset 0 if found NE 1 then ncdf_attget cdfid name attnames found add_offset ELSE add_offset 0 found where lowattnames EQ scale_factor 0 if found NE 1 then ncdf_attget cdfid name attnames found scale_factor ELSE scale_factor 1 missing_value no found where lowattnames EQ _fillvalue 0 if found NE 1 then ncdf_attget cdfid name attnames found missing_value found where lowattnames EQ missing_value 0 if found NE 1 then ncdf_attget cdfid name attnames found missing_value ENDIF ELSE BEGIN IF NOT keyword_set callitself THEN varunit add_offset 0 scale_factor 1 missing_value no ENDELSE vardate We make a legible date in function of the specified language year long beginning 0 10000 month long beginning 0 100 MOD 100 day long beginning 0 MOD 100 vardate string format C CMoA 31 month 1 strtrim day 1 strtrim year 1 varexp file_basename filename we apply reverse if keyword_set key_yreverse AND ny NE 1 THEN res reverse reform res nx ny nz jpt overwrite 2 if keyword_set key_zreverse AND nz NE 1 AND varcontient ndims where varcontient dim EQ contient recdim 0 NE 1 EQ 3 THEN res reverse reform res nx ny nz jpt overwrite 3 We apply the value valmask on land points if NOT keyword_set cont_nofill then begin valmask 1e20 case 1 of varcontient ndims eq 2:BEGIN xy array mask mask 0 earth where mask EQ 0 END varcontient ndims eq 3 AND where varcontient dim EQ contient recdim 0 EQ 1:BEGIN xyz array earth where mask EQ 0 END varcontient ndims eq 3 AND where varcontient dim EQ contient recdim 0 NE 1:BEGIN xyt array mask mask 0 earth where mask EQ 0 if earth 0 NE 1 then BEGIN earth earth replicate 1 jpt replicate nx ny n_elements earth lindgen jpt END END varcontient ndims eq 4:BEGIN xyzt array earth where mask EQ 0 if earth 0 NE 1 then BEGIN earth earth replicate 1 jpt replicate nx ny nz n_elements earth lindgen jpt END END endcase ENDIF ELSE earth 1 we look for missing_value IF size missing_value type NE 7 then BEGIN IF size missing_value type EQ 1 THEN BEGIN IF isnumber string missing_value tmp EQ 1 THEN missing_value tmpENDIF if missing_value NE valmask then begin if abs missing_value LT 1e6 then missing where res EQ missing_value ELSE missing where abs res gt abs missing_value 10 ENDIF ELSE missing 1 ENDIF ELSE missing 1 we apply add_offset scale_factor and missing_value if scale_factor NE 1 then res temporary res scale_factor if add_offset NE 0 then res temporary res add_offset if missing 0 NE 1 then res temporary missing values f_nan if earth 0 NE 1 then res temporary earth 1 e20 if it is roms outputs we need to get additionals infos IF NOT keyword_set callitself THEN BEGIN IF strmid dimnames 0 0 3 EQ xi_ AND strmid dimnames 1 0 4 EQ eta_ THEN BEGIN ncdf_attget cdfid theta_s theta_s global ncdf_attget cdfid theta_b theta_b global ncdf_attget cdfid hc hc global look for all variables names allvarnames strarr contient nvars FOR i 0 contient nvars 1 DO BEGIN tmp ncdf_varinq cdfid i allvarnames i tmp name ENDFOR CASE 1 OF keyword_set zetazero :zeta fltarr nx ny jpt keyword_set zetafilename : zeta read_ncdf zeta firsttps lasttps FILENAME zetafilename TIMESTEP NOSTRUCT CONT_NOFILL CONT_NOFILL GRID vargrid CALLITSELF _EXTRA ex where allvarnames EQ zeta 0 NE 1: zeta read_ncdf zeta firsttps lasttps FILENAME filename TIMESTEP NOSTRUCT CONT_NOFILL CONT_NOFILL GRID vargrid CALLITSELF _EXTRA ex ELSE:return report The variable zeta was not found in the file please use the keyword ZETAFILENAME to specify the name of a file containing zeta or use keyword ZETAZERO to define zeta to 0 ENDCASE romszinfos h:romszinfos h zeta:temporary zeta theta_s:theta_s theta_b:theta_b hc:hc ENDIF ELSE romszinfos h: 1 zeta: 1 theta_s: 1 theta_b: 1 hc: 1 ENDIF ncdf_close cdfid IF keyword_set savedbox THEN restoreboxparam boxparam4rdncdf dat IF keyword_set nostruct THEN return res IF keyword_set key_forgetold THEN BEGIN return arr:temporary res grid:vargrid unit:varunit experiment:varexp name:varname ENDIF ELSE BEGIN return tab:temporary res grille:vargrid unite:varunit experience:varexp nom:varname ENDELSE END ");251 a[249] = new Array("./ToBeReviewed/LECTURE/read_ncdf.html", "read_ncdf.pro", "", " file_comments Reading function for the file net_cdf This program is less universal than ncdf_lec it appeal to declared variables in common pro but it is very easier to be used It considerate the declaration of the different zooms which have been defined ixminmesh premierx the declaration of the variable key_shift To put it in a nutshell the result of read_ncdf can be directly used in plt This is also this program which is used by default in our reading widgets categories Reading param NAME in required type string It define the field to be read param BEGINNING in required Relative with the time axis These can be 2 date of the type yyyymmdd and in this case we select dates which are included between these two dates 2 indexes which define between which and which time step we have to extract the temporal dimension param ENDING in required Relative with the time axis See BEGINNING param COMPATIBILITY in optional Useless defined for compatibility keyword BOXZOOM Contain the boxzoom on which we have to do the reading keyword CALLITSELF default 0 type scalar: 0 or 1 For ROMS outputs Use by read_ncdf itself to access auxilliary data h and zeta keyword FILENAME required type string It contains he file s name keyword INIT default 0 type scalar: 0 or 1 To call automatically initncdf filename and thus redefine all the grid parameters keyword GRID UTVWF to specify the type of grid Default is 1 based on the name of the file if the file ends by GRID _ TUVFW NC not case sensible or 2 T if case 1 is not found keyword TIMESTEP default 0 type scalar: 0 or 1 Specify that BEGINNING and ENDING refer to indexes of the time axis and not to dates keyword TOUT default 0 type scalar: 0 or 1 We activate it if we want to read the file on the whole domain without considerate the sub domain defined by the boxzoom or lon1 lon2 lat1 lat2 vert1 vert2 keyword NOSTRUCT default 0 type scalar: 0 or 1 We activate it if we do not want that read_ncdf send back a structure but only the array referring to the field keyword TIMEVAR type string It define the name of the variable that contains the time axis This keyword can be useful if there is no unlimited dimension or if the time axis selected by default the first 1D array with unlimited dimension is not the good one keyword ZETAFILENAME default FILENAME type string For ROMS outputs The filename of the file where zeta vriable should be read keyword ZETAZERO default 0 type scalar: 0 or 1 For ROMS outputs To define zeta to 0 instead of reading it keyword _EXTRA Used to pass your keywords returns Structure readable by litchamp pro or an array if NOSTRUCT is activated uses common pro restrictions The field must have a temporal dimension history Sebastien Masson smasson lodyc jussieu fr 15 10 1999 version Id: read_ncdf pro 209 2007 02 08 10:01:49Z smasson FUNCTION read_ncdf name beginning ending compatibility BOXZOOM boxzoom FILENAME filename PARENTIN parentin TIMESTEP timestep TIMEVAR timevar TOUT tout NOSTRUCT nostruct CONT_NOFILL CONT_NOFILL INIT init GRID grid CALLITSELF callitself ZETAFILENAME zetafilename ZETAZERO zetazero _EXTRA ex compile_opt idl2 strictarrsubs cm_4mesh cm_4data cm_4cal IF NOT keyword_set key_forgetold THEN BEGIN updatenew updatekwd ENDIF we find the filename print filename is parent a valid widget if keyword_set parentin then BEGIN parent long parentin parent parent widget_info parent managed ENDIF filename isafile filename filename IODIRECTORY iodir _EXTRA ex Opening of the name file if size filename type NE 7 then return report read_ncdf cancelled IF version OS_FAMILY EQ unix THEN spawn file filename dev null cdfid ncdf_open filename contient ncdf_inquire cdfid we check if the variable name exists in the file if ncdf_varid cdfid name EQ 1 then BEGIN ncdf_close cdfid return report variable name C not found in the file filename ENDIF varcontient ncdf_varinq cdfid name IF varcontient ndims LT 2 THEN return report read_ncdf cannot read scalar or 1D data look for the dimension names dimnames strarr varcontient ndims FOR i 0 varcontient ndims 1 DO BEGIN ncdf_diminq cdfid varcontient dim i tmp dimsize dimnames i tmp ENDFOR shall we redefine the grid parameters if keyword_set init THEN initncdf filename _extra ex check the time axis and the debut and ending dates if n_elements beginning EQ 0 then begin beginning 0 timestep 1 endif if keyword_set timestep then begin firsttps beginning 0 if n_elements ending NE 0 then lasttps ending 0 ELSE lasttps firsttps jpt lasttps firsttps 1 IF NOT keyword_set callitself then time julday 1 1 1 lindgen jpt ENDIF ELSE BEGIN if keyword_set parent then BEGIN widget_control parent get_uvalue top_uvalue filelist extractatt top_uvalue filelist IF filelist 0 EQ many THEN filelist filename currentfile where filelist EQ filename 0 time extractatt top_uvalue fileparameters currentfile time_counter date1 date2jul beginning 0 if n_elements ending NE 0 then date2 date2jul ending 0 ELSE date2 date1 firsttps where time EQ date1 firsttps firsttps 0 lasttps where time EQ date2 lasttps lasttps 0 ENDIF ELSE BEGIN IF keyword_set timevar THEN BEGIN timeid ncdf_varid cdfid timevar IF timeid EQ 1 THEN BEGIN ncdf_close cdfid return report the file filename as no variable timevar C Use the TIMESTEP keyword endif timecontient ncdf_varinq cdfid timeid contient recdim timecontient dim 0 ENDIF ELSE BEGIN we find the infinite dimension timedim contient recdim if timedim EQ 1 then BEGIN ncdf_close cdfid return report the file filename as no infinite dimension C Use TIMESTEP or TIMEVAR keyword endif we find the FIRST time axis timeid 0 repeat BEGIN As long as we have not find a variable having only one dimension: the infinite one timecontient ncdf_varinq cdfid timeid that the variable contain timeid timeid 1 endrep until n_elements timecontient dim EQ 1 AND timecontient dim 0 EQ contient recdim OR timeid EQ contient nvars 1 if timeid EQ contient nvars 1 then BEGIN ncdf_close cdfid return report the file filename as no time axis variable C Use the TIMESTEP keyword endif timeid timeid 1 ENDELSE we must found the time origin of the julian calendar used in the time axis does the attribut units an dcalendar exist for the variable time axis if timecontient natts EQ 0 then BEGIN ncdf_close cdfid return report the variable timecontient name has no attribut C Use the TIMESTEP keyword or add the attribut units to the variable endif attnames strarr timecontient natts for attiq 0 timecontient natts 1 do attnames attiq ncdf_attname cdfid timeid attiq if where attnames EQ units 0 EQ 1 then BEGIN ncdf_close cdfid return report Attribut units not found for the variable timecontient name C Use the TIMESTEP keyword ENDIF now we try to find the attribut called calendar the attribute calendar exists If no we suppose that the calendar is gregorian calendar if where attnames EQ calendar 0 NE 1 then BEGIN ncdf_attget cdfid timeid calendar value value string value CASE value OF noleap :key_caltype noleap 360d :key_caltype 360d greg :IF n_elements key_caltype EQ 0 THEN key_caltype greg ELSE:BEGIN notused report Unknown calendar: value we use greg calendar key_caltype greg END ENDCASE ENDIF ELSE BEGIN notused report Unknown calendar we use key_caltype calendar IF n_elements key_caltype EQ 0 THEN key_caltype greg ENDELSE now we take acre of units attribut ncdf_attget cdfid timeid units value time_counter:units seconds since 0001 01 01 00:00:00 time_counter:units hours since 0001 01 01 00:00:00 time_counter:units days since 1979 01 01 00:00:00 time_counter:units months since 1979 01 01 00:00:00 time_counter:units years since 1979 01 01 00:00:00 we decript the units attribut to find the time origin value strtrim strcompress string value 2 mots str_sep value unite mots 0 unite strlowcase unite IF strpos unite s strlen unite 1 NE 1 THEN unite strmid unite 0 strlen unite 1 IF strpos unite julian_ NE 1 THEN unite strmid unite 7 IF unite NE second AND unite NE hour AND unite NE day AND unite NE month AND unite NE year THEN BEGIN ncdf_close cdfid return report time units does not start with seconds hours days months years ENDIF IF stregex value since 0 9 1 4 0 9 1 2 0 9 1 2 boolean EQ 0 THEN BEGIN ncdf_close cdfid return report attribut units of time has not the good format: since 0 9 1 4 0 9 1 2 0 9 1 2 ENDIF depart str_sep mots 2 ncdf_varget cdfid timeid time time double time case unite of second :time julday depart 1 depart 2 depart 0 time 86400 d hour :time julday depart 1 depart 2 depart 0 time 24 d day :time julday depart 1 depart 2 depart 0 time month :BEGIN if total fix time NE time NE 0 then we switch to days with 30d m time julday depart 1 depart 2 depart 0 round time 30 ELSE for t 0 n_elements time 1 DO time t julday depart 1 time t depart 2 depart 0 END year :BEGIN if total fix time NE time NE 0 then we switch to days with 365d y time julday depart 1 depart 2 depart 0 round time 365 ELSE for t 0 n_elements time 1 do time t julday depart 1 depart 2 depart 0 time t END ELSE:BEGIN ncdf_close cdfid return report The units attribute of the time axis must be something like: C seconds since 0001 01 01 C days since 1979 01 01 C months since 1979 01 01 C years since 1979 01 01 end ENDCASE date1 date2jul beginning 0 if n_elements ending NE 0 then date2 date2jul ending 0 ELSE date2 date1 time double time firsttps where time GE date1 firsttps firsttps 0 if firsttps EQ 1 THEN BEGIN ncdf_close cdfid return report date 1: strtrim jul2date date1 1 is not found in the time axis ENDIF lasttps where time LE date2 if lasttps 0 EQ 1 THEN BEGIN ncdf_close cdfid return report the time axis has no date before date 2: strtrim jul2date date2 1 endif lasttps lasttps n_elements lasttps 1 if lasttps LT firsttps then BEGIN ncdf_close cdfid return report the time axis has no dates between date1 and date 2: strtrim jul2date date1 1 strtrim jul2date date2 1 endif ENDELSE time time firsttps:lasttps jpt lasttps firsttps 1 ENDELSE Name of the grid on which the field refer to IF keyword_set grid THEN vargrid strupcase grid ELSE BEGIN vargrid T default definition IF finite glamu 0 EQ 1 THEN BEGIN are we in one of the case corresponding to ROMS conventions CASE 1 OF dimnames 2 long key_stride key_shift long testvar var key_shift IF n_elements key_yreverse EQ 0 THEN key_yreverse 0 IF keyword_set key_yreverse THEN BEGIN tmp jpj 1 firsty firsty jpj 1 lasty lasty tmp ENDIF IF n_elements key_zreverse EQ 0 THEN key_zreverse 0 IF keyword_set key_zreverse THEN BEGIN tmp jpk 1 firstz firstz jpk 1 lastz lastz tmp ENDIF IF key_gridtype EQ c_u OR key_gridtype EQ c_f AND vargrid EQ U OR vargrid EQ F THEN BEGIN IF keyword_set key_periodic THEN BEGIN key_shift key_shift 1 ENDIF ELSE BEGIN firstx firstx 1 lastx lastx 1 ENDELSE ENDIF IF key_gridtype EQ c_v OR key_gridtype EQ c_f AND vargrid EQ V OR vargrid EQ F THEN BEGIN firsty firsty 1 lasty lasty 1 ENDIF read_ncdf_varget IF key_gridtype EQ c_u OR key_gridtype EQ c_f AND keyword_set key_periodic AND strupcase vargrid EQ U OR strupcase vargrid EQ F THEN key_shift key_shift 1 We define global variable joined with the variable varname IF NOT keyword_set callitself THEN varname name varunit if varcontient natts NE 0 then begin attnames strarr varcontient natts for attiq 0 varcontient natts 1 do attnames attiq ncdf_attname cdfid name attiq lowattnames strlowcase attnames found where lowattnames EQ units 0 IF found NE 1 then ncdf_attget cdfid name attnames found value ELSE value IF NOT keyword_set callitself THEN varunit strtrim string value 2 found where lowattnames EQ add_offset 0 if found NE 1 then ncdf_attget cdfid name attnames found add_offset ELSE add_offset 0 found where lowattnames EQ scale_factor 0 if found NE 1 then ncdf_attget cdfid name attnames found scale_factor ELSE scale_factor 1 missing_value no found where lowattnames EQ _fillvalue 0 if found NE 1 then ncdf_attget cdfid name attnames found missing_value found where lowattnames EQ missing_value 0 if found NE 1 then ncdf_attget cdfid name attnames found missing_value ENDIF ELSE BEGIN IF NOT keyword_set callitself THEN varunit add_offset 0 scale_factor 1 missing_value no ENDELSE vardate We make a legible date in function of the specified language year long beginning 0 10000 month long beginning 0 100 MOD 100 day long beginning 0 MOD 100 vardate string format C CMoA 31 month 1 strtrim day 1 strtrim year 1 varexp file_basename filename we apply reverse IF keyword_set key_yreverse AND ny NE 1 THEN BEGIN IF varcontient ndims where varcontient dim EQ contient recdim 0 NE 1 EQ 2 THEN res reverse reform res nx ny jpt overwrite 2 ELSE res reverse reform res nx ny nz jpt overwrite 2 ENDIF if keyword_set key_zreverse AND nz NE 1 AND varcontient ndims where varcontient dim EQ contient recdim 0 NE 1 EQ 3 THEN res reverse reform res nx ny nz jpt overwrite 3 We apply the value valmask on land points if NOT keyword_set cont_nofill then begin valmask 1e20 case 1 of varcontient ndims eq 2:BEGIN xy array mask mask 0 earth where mask EQ 0 END varcontient ndims eq 3 AND where varcontient dim EQ contient recdim 0 EQ 1:BEGIN xyz array earth where mask EQ 0 END varcontient ndims eq 3 AND where varcontient dim EQ contient recdim 0 NE 1:BEGIN xyt array mask mask 0 earth where mask EQ 0 if earth 0 NE 1 then BEGIN earth earth replicate 1 jpt replicate nx ny n_elements earth lindgen jpt END END varcontient ndims eq 4:BEGIN xyzt array earth where mask EQ 0 if earth 0 NE 1 then BEGIN earth earth replicate 1 jpt replicate nx ny nz n_elements earth lindgen jpt END END endcase ENDIF ELSE earth 1 we look for missing_value IF size missing_value type NE 7 then BEGIN IF size missing_value type EQ 1 THEN BEGIN missing_value strlowcase string missing_value IF strmid missing_value 0 1 reverse_offset EQ f THEN missing_value strmid missing_value 0 strlen missing_value 1 IF isnumber string missing_value tmp EQ 1 THEN missing_value tmp ELSE BEGIN print Warning: missing value is not a number: missing_value missing_value 1 ENDELSE ENDIF if missing_value NE valmask then begin if abs missing_value LT 1e6 then missing where res EQ missing_value ELSE missing where abs res gt abs missing_value 10 ENDIF ELSE missing 1 ENDIF ELSE missing 1 we apply add_offset scale_factor and missing_value if scale_factor NE 1 then res temporary res scale_factor if add_offset NE 0 then res temporary res add_offset if missing 0 NE 1 then res temporary missing values f_nan if earth 0 NE 1 then res temporary earth 1 e20 if it is roms outputs we need to get additionals infos IF NOT keyword_set callitself THEN BEGIN IF strmid dimnames 0 0 3 EQ xi_ AND strmid dimnames 1 0 4 EQ eta_ THEN BEGIN ncdf_attget cdfid theta_s theta_s global ncdf_attget cdfid theta_b theta_b global ncdf_attget cdfid hc hc global look for all variables names allvarnames strarr contient nvars FOR i 0 contient nvars 1 DO BEGIN tmp ncdf_varinq cdfid i allvarnames i tmp name ENDFOR CASE 1 OF keyword_set zetazero :zeta fltarr nx ny jpt keyword_set zetafilename : zeta read_ncdf zeta firsttps lasttps FILENAME zetafilename TIMESTEP NOSTRUCT CONT_NOFILL CONT_NOFILL GRID vargrid CALLITSELF _EXTRA ex where allvarnames EQ zeta 0 NE 1: zeta read_ncdf zeta firsttps lasttps FILENAME filename TIMESTEP NOSTRUCT CONT_NOFILL CONT_NOFILL GRID vargrid CALLITSELF _EXTRA ex ELSE:return report The variable zeta was not found in the file please use the keyword ZETAFILENAME to specify the name of a file containing zeta or use keyword ZETAZERO to define zeta to 0 ENDCASE romszinfos h:romszinfos h zeta:temporary zeta theta_s:theta_s theta_b:theta_b hc:hc ENDIF ELSE romszinfos h: 1 zeta: 1 theta_s: 1 theta_b: 1 hc: 1 ENDIF ncdf_close cdfid IF keyword_set savedbox THEN restoreboxparam boxparam4rdncdf dat IF keyword_set nostruct THEN return res IF keyword_set key_forgetold THEN BEGIN return arr:temporary res grid:vargrid unit:varunit experiment:varexp name:varname ENDIF ELSE BEGIN return tab:temporary res grille:vargrid unite:varunit experience:varexp nom:varname ENDELSE END "); 252 252 a[250] = new Array("./ToBeReviewed/LECTURE/read_ncdf_varget.html", "read_ncdf_varget.pro", "", ""); 253 253 a[251] = new Array("./ToBeReviewed/LECTURE/xncdf_lec.html", "xncdf_lec.pro", "", " file_comments Reading of a Net Cdf file with widgets categories Widget param NAME in optional type string It give the name of the file to be opened If NAME does not contain the separating character of directories under unix for example the file will be looked for in the current directory keyword IODIR type string It contains the directory where to go look for the file to be read If NAME does not contain the separating character of directories under unix for example the file will be called iodir nom_fichier keyword COUNT type vector An optional vector containing the counts to be used in reading Value COUNT is a 1 based vector with an element for each dimension of the data to be written The default matches the size of the variable so that all data is written out keyword GROUP The widget ID of the widget that calls XNCDF_LEC When this ID is specified a death of the caller results in a death of XNCDF_LEC keyword OFFSET type vector default 0 0 An optional vector containing the starting position for the read The default start position is 0 0 keyword SHIFT type vector default 0 0 A vector of integers specifying for each dimension how much we have to shift it By default it is 0 0 See the function shift for more explanations BEWARE the shift is done on the biggest array before a possible reduction determined by OFFSET and COUNT On the other hand it is done after the possible extraction created by the STRIDE keyword STRIDE type vector default 1 1 An optional vector containing the strides or sampling intervals between accessed values of the netCDF variable The default stride vector is that for a contiguous read 1 1 returns 2 different cases: 1 None attribute has been selected In this case res is the array we wanted to read 2 Some attributes has been selected In this case res is a structure whose the first element having the name of the variable is the values array and the other arguments are the select arguments uses wididbase infovariable resultat motcle examples help xncdf_lec history Sebastien Masson smasson lodyc jussieu fr 24 8 1999 version Id: xncdf_lec pro 163 2006 08 29 12:59:46Z navarro FUNCTION xncdf_lec name ATT att COUNT count GROUP group OFFSET offset IODIR iodir SHIFT shift STRIDE stride VAR var compile_opt idl2 strictarrsubs COMMON wididbase base COMMON infovariable cdfid listename contient nomdim tailledim varid varcontient COMMON resultat res COMMON motcle mcatt mccount mcoffset mciodir mcshift mcstride mcvar Trick for using keywords we pass by variables declarated in a common res 1 if keyword_set att then mcatt att ELSE mcatt 0 if keyword_set count then mccount count ELSE mccount 0 if keyword_set offset then mcoffset offset ELSE mcoffset 0 if keyword_set shift then mcshift shift ELSE mcshift 0 if keyword_set stride then mcstride stride ELSE mcstride 0 if keyword_set var then mcvar var ELSE mcvar 0 choice of the file s name What type of machine is used thisOS strupcase strmid version os_family 0 3 CASE thisOS of MAC :sep : WIN :sep ELSE: sep ENDCASE If IODIR is not defined we initialize it at the current directory if NOT keyword_set iodir then cd current iodir mciodir iodir We complete IODIR with a separating character if needed IF rstrpos iodir sep NE strlen iodir 1 THEN iodir iodir sep if n_elements name EQ 0 then BEGIN If NAME is not defined we find one thanks to the program dialog_pickfile name dialog_pickfile filter iodir nc if name 0 EQ then return 1 If we do not have find anything we go out We complete NAME by IODIR if NAME does not contain any directory separating character ENDIF ELSE if strpos name sep EQ 1 then name iodir name test findfile name Does the name looked for correspond to a file while test 0 EQ OR n_elements test GT 1 do BEGIN We look for one as long as it correspond to nothing test test 0 name dialog_pickfile filter iodir nc if name EQ then return 1 test findfile name endwhile Opening of the file name cdfid ncdf_open name contient ncdf_inquire cdfid What does this file contain Opening of the base window as columns if n_elements group EQ 0 then base widget_base column title Fichier: name align_left ELSE base widget_base column title Fichier: name align_left GROUP_LEADER group Opening of base sub windows base 1 title having the file s name base1 widget_base base column align_center rien widget_label base1 value Net Cdf filename align_center rien widget_text base1 value name align_center uvalue 1 editable File s name we can change rien widget_label base1 value We jump a line base 2 General informations on the file base2 widget_base base column Informations on global attributes if contient ngatts NE 1 then begin rien widget_label base2 value Nombre de attributs globaux: strtrim contient ngatts 1 align_left for attiq 0 contient ngatts 1 do BEGIN Loop on the number of global attributes name ncdf_attname cdfid attiq global Attribute s name ncdf_attget cdfid name value global Attribute s value rien widget_text base2 value name : strtrim string value 1 xsize 60 scroll wrap align_right endfor rien widget_label base2 value endif Informations on dimensions rien widget_label base2 value Nombre de dimensions: strtrim contient ndims 1 align_left if contient recdim NE 1 then begin Loop on the number of global attributes ncdf_diminq cdfid contient recdim name value Name and value of the dimension rien widget_label base2 value name de la dimension infinie: name align_left endif nomdim strarr contient ndims Vector containing dimensions s name tailledim lonarr contient ndims Vector containing dimensions s value for dimiq 0 contient ndims 1 do begin Loop on the number of dimensions ncdf_diminq cdfid dimiq name value Name and value of the dimension nomdim dimiq name tailledim dimiq value rien widget_label base2 value name de taille: strtrim value 1 align_right ENDFOR rien widget_label base2 value We jump a line base 3 choice of the variable base3 widget_base base column rien widget_label base3 value Nombre de variables: strtrim contient nvars 1 align_left base31 widget_base base3 row align_center Creation of a listename containing the name of all file s variables listename strarr contient nvars for varid 0 contient nvars 1 do begin varcontient ncdf_varinq cdfid varid that the variable contain listename varid varcontient name endfor rien widget_label base31 value variable Creation of a button with a pop up menu base311 widget_droplist base31 value listename uvalue 2 rien widget_label base3 value base 4 button done base4 widget_base base row base42 widget_button base4 value done uvalue 3 align_right Execution of the base window and of sub windows widget_control base realize xmanager xncdf_lec base return res end La lecture de ce programme se fait de bas en haut: 1 xncdf_lec 2 xncdf_lec_event 3 wid_var wid_var_event file_comments Procedure called by xmanager when we press on a button of a second widget created by wid_var param EVENT in required A structure caracterizing the type of event which arrive to a widget number1 2 uses wididbase resultat infovariable indicewid motcle version Id: xncdf_lec pro 163 2006 08 29 12:59:46Z navarro pro wid_var_event event compile_opt idl2 strictarrsubs COMMON wididbase base COMMON resultat res COMMON infovariable cdfid listename contient nomdim tailledim varid varcontient COMMON indicewid_var widbase1 widbase2111 widbase212 widbase213 selectatt COMMON motcle mcatt mccount mcoffset mciodir mcshift mcstride mcvar What is the type of event widget_control event id get_uvalue uval tailledimvar tailledim varcontient dim if n_elements uval EQ 0 then return case on the type of event case uval OF 1:BEGIN We change values in the array We check that values put in the array are not totally false widget_control widbase1 get_value table Is it the good type of argument If the type is wrong we automatically change it by default values if event x GT size table 1 then return if event y GT size table 2 then return if size table event x event y type GE 6 OR size table event x event y type EQ 0 then BEGIN if event x EQ 1 then widget_control widbase1 use_table_select 1 event y 1 event y set_value tailledimvar event y ELSE widget_control widbase1 use_table_select event x event y event x event y set_value 0 endif Argument with a wrong name value table fix table case event x of 0:BEGIN We touched the offset if table 0 event y LT 0 then BEGIN table 0 event y 0 widget_control widbase1 use_table_select 0 event y 0 event y set_value 0 endif If it exceed the dimension of the array we put it at the max and the cont at 1 if table 0 event y GT tailledimvar event y table 3 event y then begin widget_control widbase1 use_table_select 0 event y 1 event y set_value tailledimvar event y table 3 event y 1 ENDIF ELSE BEGIN If with the new offset the cont is too big we reduce it until it goes well if table 1 event y GT tailledimvar event y table 3 event y table 0 event y then begin widget_control widbase1 use_table_select 1 event y 1 event y set_value tailledimvar event y table 3 event y table 0 event y endif ENDELSE END 1:BEGIN We touched the cont if table 1 event y LT 1 then BEGIN table 1 event y 1 widget_control widbase1 use_table_select 1 event y 1 event y set_value 1 endif If it is too big we reduce it until it goes well if table 1 event y GT tailledimvar event y table 3 event y table 0 event y then BEGIN widget_control widbase1 use_table_select 1 event y 1 event y set_value tailledimvar event y table 3 event y table 0 event y endif END 2:BEGIN We touched the shift widget_control widbase1 use_table_select 2 event y 2 event y set_value table 2 event y MOD tailledimvar event y table 3 event y END 3:BEGIN We touched the stride if table 3 event y LT 1 then BEGIN table 3 event y 1 widget_control widbase1 use_table_select 3 event y 3 event y set_value 1 endif if table 3 event y EQ 0 then It must not be null widget_control widbase1 use_table_select 3 event y 3 event y set_value 1 It must not be too big if table 3 event y GT tailledimvar event y then widget_control widbase1 use_table_select 0 event y 3 event y set_value 0 1 0 tailledimvar event y ELSE BEGIN if table 1 event y GT tailledimvar event y table 3 event y table 0 event y then begin widget_control widbase1 use_table_select 1 event y 1 event y set_value tailledimvar event y table 3 event y table 0 event y endif ENDELSE END ELSE: endcase END 2111:BEGIN We touched buttons yes no We update the vector selectatt at 0 or 1 for the concerned attribute number event id selectatt where widbase2111 EQ event id event select end 31:BEGIN We pressed on get widget_control widbase1 get_value table table fix table mcshift where table 2 NE 0 mcoffset table 0 mccount table 1 mcstride table 3 if mcshift 0 NE 1 then BEGIN There are some shifts We read the wholeness of dimensions for which ones there is a shift mcoffset mcshift 0 mccount mcshift tailledimvar mcshift We do not activate stride when there is no need because it makes write something weird on the screen if total mcstride EQ n_elements mcstride then ncdf_varget cdfid varid res OFFSET mcoffset COUNT mccount ELSE ncdf_varget cdfid varid res OFFSET mcoffset COUNT mccount STRIDE mcstride To do the shift mcshift table 2 mcoffset table 0 mccount table 1 We define the command allowing to do a shift commande res shift res for dim 0 varcontient ndims 1 do commande commande string table 2 dim commande commande rien execute commande We redefine the command allowing to cut dimensions which has not been cut yet ones we shift commande res res initialization of the command for dim 0 varcontient ndims 1 do BEGIN if mcshift dim EQ 0 then commande commande ELSE commande commande string mcoffset dim : string mccount dim mcoffset dim 1 ENDFOR commande strmid commande 0 strlen commande 1 rien execute commande Case without shift we read directly the good part of the array ENDIF ELSE BEGIN if total mcstride EQ n_elements mcstride then ncdf_varget cdfid varid res OFFSET mcoffset COUNT mccount ELSE ncdf_varget cdfid varid res OFFSET mcoffset COUNT mccount STRIDE mcstride ENDELSE Do we have to constitute a structure with selected attributes if total selectatt NE 0 then BEGIN There are selected attributes res create_struct varcontient name res We create the structure selectatt where selectatt EQ 1 We find selected attributes for attid 0 n_elements selectatt 1 do BEGIN for which we take widget_control widbase212 selectatt attid get_value attname the name widget_control widbase213 selectatt attid get_value attvalue the value res create_struct res attname 0 attvalue 0 We concatenate the structure endfor endif widget_control event top destroy We shut the second widget widget_control base destroy We shut the first widget ncdf_close cdfid END 32: Case of the display of a held with xdisplayfile 33:widget_control event top destroy We shut the second widget ELSE: endcase return end file_comments This procedure manage the second created whiget when we call xncdf_lec This widget concern the reading of the variable param WIDID_PERE type scalar in required It contains the identity of the father widget which was created by xncdf_lec and which has allowed to select the variable to be read OUTPUTS: indirectement res le tableau ou la structure resultat uses resultat infovariable indicewid_var motcle version Id: xncdf_lec pro 163 2006 08 29 12:59:46Z navarro PRO wid_var widid_pere compile_opt idl2 strictarrsubs COMMON resultat res COMMON infovariable cdfid listename contient nomdim tailledim varid varcontient COMMON indicewid_var widbase1 widbase2111 widbase212 widbase213 selectatt COMMON motcle mcatt mccount mcoffset mciodir mcshift mcstride mcvar res 1 Opening of the base window as columns widbase widget_base column title variable: varcontient name align_center group_leader widid_pere Opening of the base subwindow widbase1 array of offsets rien widget_label widbase value We jump a line Definition of labels of lines of the array rowlab string tailledim varcontient dim for i 0 n_elements rowlab 1 do rowlab i strtrim rowlab i 1 rowlab nomdim varcontient dim replicate : n_elements varcontient dim rowlab Definition of array s initial values valinit lonarr 4 n_elements varcontient dim column 0 : offsets if keyword_set mcoffset AND n_elements mcoffset EQ varcontient ndims THEN valinit 0 mcoffset ELSE valinit 0 0 colomn 1 : counts if keyword_set mccount AND n_elements mccount EQ varcontient ndims THEN valinit 1 mccount ELSE valinit 1 tailledim varcontient dim column 2 : shifts if keyword_set mcshift AND n_elements mcshift EQ varcontient ndims THEN valinit 2 mcshift ELSE valinit 2 0 column 3 : strides if keyword_set mcstride AND n_elements mcstride EQ varcontient ndims THEN valinit 3 mcstride ELSE valinit 3 1 test of initial values of the array valinit fix valinit valinit 3 1 valinit 3 valinit 0 valinit 1 tailledim varcontient dim valinit 3 valinit 0 valinit 2 valinit 2 MOD tailledim varcontient dim valinit 3 test of shifts declaration of the array widbase1 widget_table widbase row_labels rowlab value valinit editable column_labels Offset Count Shift Stride uvalue 1 un petit blabla rien widget_label widbase value ATTENTION: Faire des return pour que les valeurs align_center rien widget_label widbase value du tableau ou des textes soient bien prises en compte align_center widbase2 choice of attributes rien widget_label widbase value We jump a line widbase2 widget_base widbase column To each attribute we created a widget widbase21 containing in line a button yes no widbase211 and two wigdet text widbase212 widbase213 comprising the name and the value of the attribute widbase21 lonarr varcontient natts widbase211 lonarr varcontient natts widbase2111 lonarr varcontient natts Vector which will serve to know which yes no are selected see wid_var_event selectatt lonarr varcontient natts selectatt 0 widbase212 lonarr varcontient natts widbase213 lonarr varcontient natts for attid 0 varcontient natts 1 do BEGIN Lop on the number of attribute widbase21 attid widget_base widbase2 row name ncdf_attname cdfid varid attid ncdf_attget cdfid varid name value widbase211 attid widget_base widbase21 attid nonexclusive widbase2111 attid widget_button widbase211 attid value uvalue 2111 widbase212 attid widget_text widbase21 attid value name editable widbase213 attid widget_text widbase21 attid value strtrim string value 1 editable endfor widbase3 buttons of the bottom widbase3 widget_base widbase row align_center widbase31 widget_button widbase3 value GET uvalue 31 widbase32 widget_button widbase3 value Help uvalue 32 widbase33 widget_button widbase3 value DONE uvalue 33 execution of the base window and of sub window widget_control widbase realize xmanager wid_var widbase return end file_comments Procedure called by xmanager when we press a button of the first widget created by par xncdf_lec param EVENT A structure caracterising the event type which arrive at the widget number 1 uses resultat infovariable motcle version Id: xncdf_lec pro 163 2006 08 29 12:59:46Z navarro PRO xncdf_lec_event event compile_opt idl2 strictarrsubs COMMON resultat res COMMON infovariable cdfid listename contient nomdim tailledim varid varcontient COMMON motcle mcatt mccount mcoffset mciodir mcshift mcstride mcvar What is the type of event widget_control event id get_uvalue uval case on the type of event case uval of 1:BEGIN We want to read an other file widget_control event id get_value nom We recuperate the name widget_control event top destroy We shut the widget ncdf_close cdfid We shut the wrong file which has been opened We call back xncdf_lec res xncdf_lec nom 0 ATT mcatt COUNT mccount OFFSET mcoffset IODIR mciodir SHIFT mcshift STRIDE mcstride VAR mcvar return END 2:BEGIN A variable is selected varid event index We recuperat its number in the file Netcdf varcontient ncdf_varinq cdfid varid wid_var event top We call the program which launch the second widget See sooner END 3:BEGIN button done widget_control event top destroy We delete the widget ncdf_close cdfid We shut the file END ELSE: endcase return end"); … … 289 289 a[287] = new Array("./ToBeReviewed/PLOTS/VECTEUR/vecteur.html", "vecteur.pro", "", " file_comments categories param ANGLE returns restrictions examples history version Id: vecteur pro 163 2006 08 29 12:59:46Z navarro FUNCTION cv_cm2normal angle Give the length in normal coordinates of a trait oriented of an angle by rapport at the x axis and which must do 1 cm on the drawing Angle can be an array compile_opt idl2 strictarrsubs common What is the length in normal coordinates of a trait which will do 1 cm on the paper an which is parallel to x mipgsz min page_size max mapgsz sizexfeuille mipgsz key_portrait mapgsz 1 key_portrait sizeyfeuille mapgsz key_portrait mipgsz 1 key_portrait cm_en_normal 1 sizexfeuille If the aspect rapport of the window is not equal to 1 the length in normalized coordinates of a trait of 1 cm vary following the polar angle of this trait aspect sizexfeuille sizeyfeuille cm_en_normal cm_en_normal sqrt 1 aspect 2 1 sin angle 2 return cm_en_normal END file_comments categories param U param V param W restrictions examples history version Id: vecteur pro 163 2006 08 29 12:59:46Z navarro PRO normalise u v w normalize the vector compile_opt idl2 strictarrsubs IF n_elements w NE 0 THEN BEGIN norme sqrt u 2 v 2 w 2 ind where norme NE 0 u ind u ind norme ind v ind v ind norme ind w ind w ind norme ind ENDIF ELSE BEGIN norme sqrt u 2 v 2 ind where norme NE 0 u ind u ind norme ind v ind v ind norme ind ENDELSE END file_comments Trace vectors even if they are on a deformed grid on any projection In this way all vectors have a comparable norme on the drawing to be clear a vector which measure 1 cm measure it no matter the projection and is position on the sphere categories Graphics param COMPOSANTEU in required It is the u component of the vector to be traced This 2d array has the same dimension that reduitindice2d see further param COMPOSANTEV in required It is the v component of the vector to be traced This 2d array has the same dimension that reduitindice2d see further param NORMEVECTEUR param INDICE2D in required It in an index allowing to to pass from an jpi or jpj array to the zoom on which we do the drawing param REDUITINDICE2D in required It is an index allowing to pass from an array defined by indice2d to the array for which we really have vectors to be traced to be clear it is for example when we trace only one vector on two keyword CMREF default between 5 and 1 5 cm The length in cm that must measure the arrow normed normeref By default it is adjusted to other drawing and included between 5 and 1 5 cm keyword MISSING The value of a missing value Do not use this keyword Fixed at 1e5 by ajoutvect pro keyword NORMEREF The norme of the reference arrow keyword VECTCOLOR default 0 The color of the arrow Black by default color 0 keyword VECTTHICK default 1 The thick of the arrow keyword VECTREFPOS Vector composed of 2 elements specifying the position on DATA coordinates from the beginning of the reference vector By default at the right bottom of the drawing keyword VECTREFFORMAT The format to be used to specify the norme of the reference vector keyword NOVECTREF To delete the display of the reference vector keyword _EXTRA Used to pass your keywords uses common pro history Creation : 13 02 98 G Roullet grlod lodyc jussieu fr Modification : 14 01 99 realise la transformation spheriquecartesien G Roullet 12 03 99 verification de la routine G Roullet 8 11 1999: G Roullet et Sebastien Masson smasson lodyc jussieu fr adaptation pour les zoom reverification traitement separe de la direction et de la norme des vecteurs mots cles NORMEREF et CMREF version Id: vecteur pro 163 2006 08 29 12:59:46Z navarro PRO vecteur composanteu composantev normevecteur indice2d reduitindice2d CMREF cmref MISSING missing NORMEREF normeref VECTCOLOR vectcolor VECTTHICK vectthick VECTREFPOS vectrefpos VECTREFFORMAT vectrefformat NOVECTREF novectref _extra extra compile_opt idl2 strictarrsubs common tempsun systime 1 For key_performance taille size composanteu nx taille 1 ny taille 2 if n_elements reduitindice2d EQ 0 then reduitindice2d lindgen nx ny zu composanteu zv composantev norme normevecteur taille size indice2d nxgd taille 1 nygd taille 2 msk replicate 1 nx ny if keyword_set missing then terre where abs zu GE missing 10 ELSE terre 1 if terre 0 NE 1 then BEGIN msk terre 0 zu terre 0 zv terre 0 norme terre 0 ENDIF Stage 1: Given that the directions and the sense that the vector has on the sphere we have to try to determinate this direction and the sense that the vector will have on the screen once it will have been projected In theory: on the sphere a vector in a given point has for direction the tangent at the circle passing by the center of the Earth and by the vector So find the direction once the projection is done it is find the tangent to the curve representing the projection of the circle on the 2d plan at the point representing the projection of the starting point of the shere on the 2d plan In practice we do no know the definition of the curve given by the projection of a circle so find its tangente in a point What we do: In a 3d cartesian reference a We find coorinates of the point T starting of the arrow situed on the sphere b To each point T we determine local directions defined by the grid on this point and on which coordinates u v of the vector refer to These local directions are defined by gradients of glam and gphi Once we have obtain these directions we considare them like orthogonal and by norming them we build an orthonormal reference nu nv on which coordinates u v of the vector refer to In the starting 3d cartesian reference the vector is defined by: V u nu v nv where V nu and nv are 3d vectors and u and v are scalars c To approximate the tangente to the circle by the chord defined by the beginning and the ending of the arrow we will normalize V and then divide it by 100 d This allows us to determine coordinates of extremities of the chord in the 3d cartesian reference We pass them in spherical coordinates in order to recuperate latitude and longitude position of these points on the sphere e We pass coordinates of these points in normalized coordinates then in polar coordinates in order to find the angle and the direction they dertermine on the drawing Stage 1 a coordinates of the point T beginning of the arrow in spherical coordinates glam glamt indice2d reduitindice2d gphi gphit indice2d reduitindice2d Coordinates of the point T beginning of the arrow in the cartesian reference For the sphere we use a sphere with a radius of 1 radius replicate 1 nx ny coord_sphe transpose glam gphi radius r cv_coord from_sphere coord_sphe to_rect degrees x0 reform r 0 nx ny y0 reform r 1 nx ny z0 reform r 2 nx ny Stage 1 b Construction of a vector nu resp nv vectr normed carried by the axis of points u i j and u i 1 j resp v i j and v i j 1 which define for each point on the sphere local directions associated with u and v These vectors define a local orthonormal reference These vectors are built in a cartesian reference cv_coord We have choose a unity radius of the Earth unit definition of nu radius replicate 1 nxgd nygd IF finite glamu 0 gphiu 0 NE 0 THEN coord_sphe transpose glamu indice2d gphiu indice2d radius ELSE coord_sphe transpose glamf indice2d gphit indice2d radius r cv_coord from_sphere coord_sphe to_rect degrees coordinates of points of the grid u in cartesian ux reform r 0 nxgd nygd uy reform r 1 nxgd nygd uz reform r 2 nxgd nygd calculation of nu nux ux shift ux 1 0 nuy uy shift uy 1 0 nuz uz shift uz 1 0 conditions at extremities if NOT keyword_set key_periodic OR nxgd NE jpi then begin nux 0 nux 1 nuy 0 nuy 1 nuz 0 nuz 1 ENDIF reduction of the grid nux nux reduitindice2d nuy nuy reduitindice2d nuz nuz reduitindice2d definition of nv IF finite glamv 0 gphiv 0 NE 0 THEN coord_sphe transpose glamv indice2d gphiv indice2d radius ELSE coord_sphe transpose glamt indice2d gphif indice2d radius r cv_coord from_sphere coord_sphe to_rect degrees coordinates of points of the grid in cartesian vx reform r 0 nxgd nygd vy reform r 1 nxgd nygd vz reform r 2 nxgd nygd calcul of nv nvx vx shift vx 0 1 nvy vy shift vy 0 1 nvz vz shift vz 0 1 conditions at extremities nvx 0 nvx 1 nvy 0 nvy 1 nvz 0 nvz 1 reduction of the grid nvx nvx reduitindice2d nvy nvy reduitindice2d nvz nvz reduitindice2d normalization normalise nux nuy nuz normalise nvx nvy nvz Stage 1 c coordinates of the vector V in the cartesian reference direcx zu nux zv nvx direcy zu nuy zv nvy direcz zu nuz zv nvz normalization of the vector V normalise direcx direcy direcz on divide by 100 direcx direcx 100 direcy direcy 100 direcz direcz 100 Stege 1 d coordinates of the point of the arrow in the cartesian reference x1 x0 direcx y1 y0 direcy z1 z0 direcz coordinates of the point of the arrow in spherical coordinates coord_rect transpose x1 y1 z1 r cv_coord from_rect coord_rect to_sphere degrees glam1 reform r 0 nx ny gphi1 reform r 1 nx ny modification of glams Everything take place at the level of the line of changing of date BEWARE do not cut arrow which goes out of the window test: If it goes out of the frame but thanks to 360 it come in we modify it ind where glam1 LT x range 0 AND glam1 360 LE x range 1 if ind 0 NE 1 then glam1 ind glam1 ind 360 ind where glam1 GT x range 1 AND glam1 360 GE x range 0 if ind 0 NE 1 then glam1 ind glam1 ind 360 ind where glam LT x range 0 AND glam 360 LE x range 1 if ind 0 NE 1 then glam ind glam ind 360 ind where glam GT x range 1 AND glam 360 GE x range 0 if ind 0 NE 1 then glam ind glam ind 360 Stage 1 e r convert_coord glam gphi data to_normal x0 r 0 normal coordinates of the beginning of the array y0 r 1 r convert_coord glam1 gphi1 data to_normal x1 r 0 normal coordinates of the ending of the array Before scaling y1 r 1 tests to avoid that arrows be drawing out of the domain out where x0 LT p position 0 OR x0 GT p position 2 OR y0 LT p position 1 OR y0 GT p position 3 if out 0 NE 1 THEN x0 out values f_nan Following projections there may are points at NaN when we pass in normal coordinates We delete these points nan finite x0 y0 x1 y1 number where nan EQ 1 x0 x0 number x1 x1 number y0 y0 number y1 y1 number msk msk number norme norme number We define the vector direction in the normalize reference dirx x1 x0 diry y1 y0 We pass in polar coordinates to recuperate the angle which wasb the goal of all the first stage dirpol cv_coord from_rect transpose dirx diry to_polar dirpol msk dirpol 0 Stage 2 Now we take care of the norme Automatic putting at the scale if NOT keyword_set cmref then BEGIN mipgsz min page_size max mapgsz sizexfeuille mipgsz key_portrait mapgsz 1 key_portrait sizexfeuille 10 sizexfeuille cmref 5 floor sizexfeuille 10 15 cmref cmref 10 ENDIF if NOT keyword_set normeref then BEGIN value max norme puissance10 10 floor alog10 value normeref puissance10 floor value puissance10 endif cm 1 normeref cmref We modify the array norme to an element having the value cm be represented by a trait of lenght 1 cm on the paper Norme contain the norme of vectors we want to draw norme 1 1 cm norme cv_cm2normal dirpol Stage 3 Now that we have the angle and the norme we recuperate coordinates in rectangular and we draw arrows r cv_coord from_polar transpose dirpol norme to_rect composantex r 0 composantey r 1 x1 x0 composantex y1 y0 composantey Drawing if NOT KEYWORD_SET vectcolor then vectcolor 0 points where msk EQ 1 IF points 0 NE 1 THEN arrow x0 points y0 points x1 points y1 points norm hsize 2 COLOR vectcolor THICK vectthick Draw an arrow at the right bottom of the drawing as a caption if NOT keyword_set novectref then BEGIN dx cmref cv_cm2normal 0 Lenght of the vector of reference in normalzed coordinates if keyword_set vectrefformat then normelegende strtrim string normeref format vectrefformat 1 ELSE normelegende strtrim normeref 1 if keyword_set vectrefpos then begin r convert_coord vectrefpos data to_normal x0 r 0 y0 r 1 ENDIF ELSE BEGIN x0 x window 1 dx r convert_coord d x_ch_size d y_ch_size device to_normal dy 3 r 1 p charsize y0 y window 0 dy ENDELSE arrow x0 y0 x0 dx y0 norm hsize 2 color 0 xyouts x0 y0 normelegende norm align 1 charsize p charsize color 0 endif if keyword_set key_performance NE 0 THEN print temps vecteur systime 1 tempsun return END "); 290 290 a[288] = new Array("./ToBeReviewed/PLOTS/VECTEUR/velovect.html", "velovect.pro", "", " file_comments Produce a two dimensional velocity field plot A directed arrow is drawn at each point showing the direction and magnitude of the field categories Plotting two dimensional param U in required The X component of the two dimensional field U must be a two dimensional array param V in required The Y component of the two dimensional field Y must have the same dimensions as X The vector at point i j has a magnitude of: U i j 2 V i j 2 0 5 and a direction of: ATAN2 V i j U i j param X in optional type vector Optional abscissa values X must be a vector with a length equal to the first dimension of U and V param Y in optional type vector Optional ordinate values Y must be a vector with a length equal to the first dimension of U and V keyword COLOR The color index used for the plot keyword DOTS Set this keyword to 1 to place a dot at each missing point Set this keyword to 0 or omit it to draw nothing for missing points Has effect only if MISSING is specified keyword LENGTH default 1 0 Length factor The default of 1 0 makes the longest U V vector the length of a cell keyword MISSING Missing data value Vectors with a LENGTH greater than MISSING are ignored keyword OVERPLOT Set this keyword to make VELOVECT overplot That is the current graphics screen is not erased no axes are drawn and the previously established scaling remains in effect keyword CLIP keyword NOCLIP keyword _EXTRA Used to pass your keywords restrictions Plotting on the selected device is performed System variables concerning plotting are changed Note: All other keywords are passed directly to the PLOT procedure and may be used to set option such as TITLE POSITION NOERASE etc history DMS RSI Oct 1983 For Sun DMS RSI April 1989 Added TITLE Oct 1990 Added POSITION NOERASE COLOR Feb 91 RES August 1993 Vince Patrick Adv Visualization Lab U of Maryland fixed errors in math August 1993 DMS Added _EXTRA keyword inheritance January 1994 KDB Fixed integer math which produced 0 and caused divide by zero errors December 1994 MWR Added _EXTRA inheritance for PLOTS and OPLOT June 1995 MWR Removed _EXTRA inheritance for PLOTS and changed OPLOT to PLOTS September 1996 GGS Changed denominator of x_step and y_step vars February 1998 DLD Add support for CLIP and NO_CLIP keywords June 1998 DLD Add support for OVERPLOT keyword Copyright c 1983 1998 Research Systems Inc All rights reserved Unauthorized reproduction prohibited version Id: velovect pro 163 2006 08 29 12:59:46Z navarro PRO velovect U V X Y Missing Missing Length length Dots dots Color color CLIP clip NOCLIP noclip OVERPLOT overplot _EXTRA extra compile_opt idl2 strictarrsubs on_error 2 Return to caller if an error occurs s size u t size v if s 0 ne 2 then begin baduv: message U and V parameters must be 2D and same size endif if total abs s 0:2 t 0:2 ne 0 then goto baduv if n_params 0 lt 3 then x findgen s 1 else if n_elements x ne s 1 then begin badxy: message X and Y arrays have incorrect size endif if n_params 1 lt 4 then y findgen s 2 else if n_elements y ne s 2 then goto badxy if n_elements missing le 0 then missing 1 0e30 if n_elements length le 0 then length 1 0 mag sqrt u 2 v 2 magnitude Subscripts of good elements nbad 0 of missing points if n_elements missing gt 0 then begin good where mag lt missing if keyword_set dots then bad where mag ge missing nbad endif else begin good lindgen n_elements mag endelse ugood u good vgood v good x0 min x get scaling x1 max x y0 min y y1 max y x_step x1 x0 s 1 1 0 Convert to float Integer math y_step y1 y0 s 2 1 0 could result in divide by 0 maxmag max max abs ugood x_step max abs vgood y_step sina length ugood maxmag cosa length vgood maxmag if n_elements title le 0 then title plot to get axes if n_elements color eq 0 then color p color if n_elements noclip eq 0 then noclip 1 x_b0 x0 x_step x_b1 x1 x_step y_b0 y0 y_step y_b1 y1 y_step if not keyword_set overplot then begin if n_elements position eq 0 then begin plot x_b0 x_b1 y_b1 y_b0 nodata xst yst color color _EXTRA extra endif else begin plot x_b0 x_b1 y_b1 y_b0 nodata xst yst color color _EXTRA extra endelse endif if n_elements clip eq 0 then clip x crange 0 y crange 0 x crange 1 y crange 1 r 3 len of arrow head angle 22 5 dtor Angle of arrowhead st r sin angle sin 22 5 degs length of head ct r cos angle for i 0 n_elements good 1 do begin Each point x0 x good i mod s 1 get coords of start end dx sina i x1 x0 dx y0 y good i s 1 dy cosa i y1 y0 dy xd x_step yd y_step plots x0 x1 x1 ct dx xd st dy yd xd x1 x1 ct dx xd st dy yd xd y0 y1 y1 ct dy yd st dx xd yd y1 y1 ct dy yd st dx xd yd color color clip clip noclip noclip _EXTRA extra endfor if nbad gt 0 then Dots for missing PLOTS x bad mod s 1 y bad s 1 psym 3 color color clip clip noclip noclip _EXTRA extra end"); 291 a[289] = new Array("./ToBeReviewed/PLOTS/axe.html", "axe.pro", "", " file_comments Manage axes for the different drawings created by plt pltz and pltt categories Graphics param COUPE type string It designate the type of cut to which the axes we create must report For example: xy xt param TEMPSMIN in required In the case where we do cut containing the time dimension we have to specify the beginning of the time s axis in julian days param TEMPSMAX in required In the case where we do cut containing the time dimension we have to specify the end of the time s axis in julian days keyword SIN activated when we trace in sinus of the latitude keyword SEPDATE type string It separate the different constituents of the date By default it is a return to the line when we do a yt zt or a t In the other cases it is a blank keyword DIGITSYEAR 2 to use Z format 2 digits to code years instead of Y format See help of label_date for more information on Z and Y keyword _EXTRA used to pass your keywords uses common pro restrictions It modify x and y history Sebastien Masson smasson lodyc jussieu fr 11 12 98 Eric Guilyardi types x y z amelioration de l axe temporel version Id: axe pro 163 2006 08 29 12:59:46Z navarro PRO axe coupe tempsmin tempsmax REVERSE_X reverse_x REVERSE_Y reverse_y SIN sin SEPDATE sepdate DIGITSYEAR digitsyear _EXTRA ex compile_opt idl2 strictarrsubs common tempsun systime 1 pour key_performance Management of ticks of the time axis in the case of TEMPSMIN and TEMPSMAX are definied divday 0 if n_params EQ 3 then BEGIN if keyword_set sepdate then sep sepdate ELSE if coupe EQ yt OR coupe EQ zt OR coupe EQ t then sep C ELSE sep caldat tempsmin mmin dmin ymin hmin mnmin smin _EXTRA ex caldat tempsmax mmax dmax ymax hmax mnmax smax _EXTRA ex format used for the year 2 or 4 5 digits IF NOT keyword_set digitsyear THEN digitsyear 4 IF digitsyear EQ 2 THEN fmtyr Z ELSE fmtyr Y if ymax EQ ymin then BEGIN if mmin ne mmax then BEGIN Same year but several monthes nticks mmax mmin 1 ticknom lonarr nticks for m 0 nticks 1 do ticknom m julday m mmin 1 ymin _EXTRA ex tminor 6 datfmt M sep fmtyr We check that labels are betwenn TEMPSMIN and TEMPSMAX ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax AND ticknom NE 1 nticks n_elements ticknom Particular case where we are overlap two monthes if nticks LE 1 then begin nticks dmax jourdsmois mmin ymin 0 dmin 1 2 ticknom lonarr nticks for d 0 nticks 1 do ticknom d julday mmin d 2 dmin ymin _EXTRA ex ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax AND ticknom NE 1 nticks n_elements ticknom tminor 2 datfmt D sep M endif ENDIF ELSE BEGIN Same year and same month IF dmax dmin 1 GT 4 THEN BEGIN more than 4 days nticks dmax dmin 1 ticknom lonarr nticks for d 0 nticks 1 do ticknom d julday mmin d dmin ymin _EXTRA ex ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax AND ticknom NE 1 nticks n_elements ticknom tminor 2 datfmt D sep M ENDIF ELSE BEGIN less than 4 days : divday ticks per day divday 4 nticks dmax dmin divday 1 ticknom fltarr nticks for d 0 nticks 1 do ticknom d julday mmin d divday dmin ymin _EXTRA ex d MOD divday float divday tminor 2 datfmt H:00 ENDELSE ENDELSE ENDIF ELSE BEGIN Several years CASE 1 OF ymax ymin 1 LE 10: BEGIN freq 1 tminor 12 datfmt M sep fmtyr end ymax ymin 1 LE 20: BEGIN freq 2 tminor 6 datfmt M sep fmtyr end ymax ymin 1 LE 50: BEGIN freq 5 tminor 5 datfmt M sep fmtyr end ymax ymin 1 LE 100: BEGIN freq 10 tminor 10 datfmt fmtyr end ymax ymin 1 LE 1000: BEGIN freq 50 tminor 5 datfmt fmtyr end ELSE : BEGIN freq 100 tminor 50 datfmt Y end ENDCASE nticks floor ymax ymin freq 1 IF floor ymin freq NE ymin freq THEN yminf floor ymin freq 1 freq ELSE yminf floor ymin freq freq ticknom lonarr nticks for y 0 nticks 1 do ticknom y julday 1 1 yminf y freq _EXTRA ex We check that labels are betwenn TEMPSMIN and TEMPSMAX ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax AND ticknom NE 1 nticks n_elements ticknom Particular case where we are overlap two monthes if nticks LE 1 then begin nticks mmax 12 mmin 1 ticknom lonarr nticks for m 0 nticks 1 do ticknom m julday m mmin 1 ymin _EXTRA ex ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax AND ticknom NE 1 nticks n_elements ticknom tminor 6 datfmt M sep fmtyr Particular case where we are overlap two monthes if nticks LE 1 then begin nticks dmax jourdsmois mmin ymin 0 dmin 1 2 ticknom lonarr nticks for d 0 nticks 1 do ticknom d julday mmin d 2 dmin ymin _EXTRA ex ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax AND ticknom NE 1 nticks n_elements ticknom tminor 2 datfmt D sep M endif endif ENDELSE totolabel_date 0 0 0 DATE_FORMAT datfmt _EXTRA ex if chkstru ex DATE_FORMAT then ex DATE_FORMAT ENDIF Definition of axes parameters case by case case coupe of pltv :BEGIN dtasize tempsmin x range 0 5 dtasize 0 0 5 y range 0 5 dtasize 1 0 5 if keyword_set reverse_x then x range reverse x range if keyword_set reverse_y then y range reverse y range x title nx y title ny END xy :BEGIN if keyword_set reverse_x then x range lon2 lon1 ELSE x range lon1 lon2 if keyword_set reverse_y then y range lat2 lat1 ELSE y range lat1 lat2 IF key_onearth THEN x tickformat lonaxe IF key_onearth THEN y tickformat lataxe END yz :BEGIN if keyword_set reverse_x then x range lat2 lat1 ELSE x range lat1 lat2 if keyword_set reverse_y then y range 0 1 ELSE y range 1 0 if keyword_set sin then BEGIN number of ticks by default plot 0 0 noerase nodata xtick_get xaxe We increase this number to it be around 10 ticks n_elements xaxe 1 ticks ticks 1 2 4 8 ticks ticks sort abs ticks 10 0 We recuperate the x axis for this new number of ticks plot 0 0 xticks ticks noerase nodata xtick_get xaxe x ticks ticks x tickv sin pi 180 xaxe tickname strarr ticks 1 for i 0 ticks do tickname i lataxe 0 0 xaxe i x tickname tickname x range sin pi 180 x range endif end xz :BEGIN if keyword_set reverse_x then x range lon2 lon1 ELSE x range lon1 lon2 if keyword_set reverse_y then y range 0 1 ELSE y range 1 0 end xt : begin if keyword_set reverse_x then x range lon2 lon1 ELSE x range lon1 lon2 if keyword_set reverse_y then y range tempsmax tempsmin tempsmin ELSE y range tempsmin tempsmax tempsmin IF key_onearth THEN x tickformat lonaxe result LABEL_DATE DATE_FORMAT M sep fmtyr y tickformat LABEL_DATE y tickname LABEL_DATE 1 0 ticknom _EXTRA ex y ticklen 1 y gridstyle 2 y ticks nticks 1 y tickv ticknom tempsmin y minor tminor IF divday GT 0 THEN y title Time from strtrim dmin 1 def_month 1m strtrim mmin 1 strtrim ymin 1 end yt : begin if keyword_set reverse_x then x range tempsmax tempsmin tempsmin ELSE x range tempsmin tempsmax tempsmin if keyword_set reverse_y then y range lat2 lat1 ELSE y range lat1 lat2 IF key_onearth THEN y tickformat lataxe x tickname LABEL_DATE 0 0 ticknom _EXTRA ex x ticklen 1 x gridstyle 2 x ticks nticks 1 x tickv ticknom tempsmin x minor tminor IF divday GT 0 THEN y title Time from strtrim dmin 1 def_month 1m strtrim mmin 1 strtrim ymin 1 end zt : begin if keyword_set reverse_x then x range tempsmax tempsmin tempsmin ELSE x range tempsmin tempsmax tempsmin if vargrid EQ W then gdep gdepw 0:nzw 1 ELSE gdep gdept 0:nzt 1 x tickname LABEL_DATE 0 0 ticknom _EXTRA ex x ticklen 1 x gridstyle 2 x ticks nticks 1 x tickv ticknom tempsmin x minor tminor IF divday GT 0 THEN y title Time from strtrim dmin 1 def_month 1m strtrim mmin 1 strtrim ymin 1 end t : BEGIN if keyword_set reverse_x then x range tempsmax tempsmin tempsmin ELSE x range tempsmin tempsmax tempsmin x tickname LABEL_DATE 0 0 ticknom _EXTRA ex x ticklen 1 x gridstyle 2 x ticks nticks 1 x tickv ticknom tempsmin x minor tminor IF divday GT 0 THEN y title Time from strtrim dmin 1 def_month 1m strtrim mmin 1 strtrim ymin 1 end x : begin x range lon1 lon2 IF key_onearth THEN x tickformat lonaxe END y : begin if keyword_set sin then BEGIN Number of ticks by default plot 0 0 nodata noerase xstyle 5 ystyle 5 xtick_get xaxe We increase this number to it be around 10 ticks n_elements xaxe 1 ticks ticks 1 2 4 8 ticks ticks sort abs ticks 10 0 We recuperate the x axis for this new number of ticks plot 0 0 xticks ticks nodata noerase xstyle 5 ystyle 5 xtick_get xaxe x ticks ticks x tickv sin pi 180 xaxe tickname strarr ticks 1 for i 0 ticks do tickname i lataxe 0 0 xaxe i x tickname tickname x range sin pi 180 x range ENDIF ELSE x range lat1 lat2 IF key_onearth THEN x tickformat lataxe END z : begin if vargrid EQ W then gdep gdepw 0:nzw 1 ELSE gdep gdept 0:nzt 1 if keyword_set reverse_y then y range gdep 0 gdep n_elements gdep 1 ELSE y range gdep n_elements gdep 1 gdep 0 END endcase if keyword_set key_performance THEN print temps axe systime 1 tempsun return end");291 a[289] = new Array("./ToBeReviewed/PLOTS/axe.html", "axe.pro", "", " file_comments Manage axes for the different drawings created by plt pltz and pltt categories Graphics param COUPE type string It designate the type of cut to which the axes we create must report For example: xy xt param TEMPSMIN in required In the case where we do cut containing the time dimension we have to specify the beginning of the time s axis in julian days param TEMPSMAX in required In the case where we do cut containing the time dimension we have to specify the end of the time s axis in julian days keyword SIN activated when we trace in sinus of the latitude keyword SEPDATE type string It separate the different constituents of the date By default it is a return to the line when we do a yt zt or a t In the other cases it is a blank keyword DIGITSYEAR 2 to use Z format 2 digits to code years instead of Y format See help of label_date for more information on Z and Y keyword _EXTRA used to pass your keywords uses common pro restrictions It modify x and y history Sebastien Masson smasson lodyc jussieu fr 11 12 98 Eric Guilyardi types x y z amelioration de l axe temporel version Id: axe pro 209 2007 02 08 10:01:49Z smasson PRO axe coupe tempsmin tempsmax REVERSE_X reverse_x REVERSE_Y reverse_y SIN sin SEPDATE sepdate DIGITSYEAR digitsyear _EXTRA ex compile_opt idl2 strictarrsubs common tempsun systime 1 pour key_performance Management of ticks of the time axis in the case of TEMPSMIN and TEMPSMAX are definied divday 0 if n_params EQ 3 then BEGIN if keyword_set sepdate then sep sepdate ELSE if coupe EQ yt OR coupe EQ zt OR coupe EQ t then sep C ELSE sep caldat tempsmin mmin dmin ymin hmin mnmin smin _EXTRA ex caldat tempsmax mmax dmax ymax hmax mnmax smax _EXTRA ex format used for the year 2 or 4 5 digits IF NOT keyword_set digitsyear THEN digitsyear 4 IF digitsyear EQ 2 THEN fmtyr Z ELSE fmtyr Y CASE 1 OF yearly base ymin NE 0 AND tempsmax GT julday mmin dmin ymin 3 hmin mnmin smin :BEGIN more than 3 years CASE 1 OF ymax ymin 1 GT 5000: BEGIN freq 500 tminor 5 datfmt fmtyr end ymax ymin 1 GT 2000: BEGIN freq 200 tminor 4 datfmt fmtyr end ymax ymin 1 GT 1000: BEGIN freq 100 tminor 5 datfmt fmtyr end ymax ymin 1 GT 500: BEGIN freq 50 tminor 5 datfmt fmtyr end ymax ymin 1 GT 200: BEGIN freq 20 tminor 4 datfmt fmtyr end ymax ymin 1 GT 100: BEGIN freq 10 tminor 5 datfmt fmtyr end ymax ymin 1 GT 50: BEGIN freq 5 tminor 5 datfmt M sep fmtyr end ymax ymin 1 GT 20: BEGIN freq 4 tminor 4 datfmt M sep fmtyr end ymax ymin 1 GT 10: BEGIN freq 2 tminor 4 datfmt M sep fmtyr end ELSE: BEGIN freq 1 tminor 4 datfmt M sep fmtyr end ENDCASE nticks ceil ymax ymin freq 2 yminf floor ymin freq freq ticknom lonarr nticks for y 0 nticks 1 do ticknom y julday 1 1 yminf y freq _EXTRA ex ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax nticks END monthly base tempsmax GT julday mmin 3 dmin ymin hmin mnmin smin :BEGIN more than 3 months CASE 1 OF tempsmax GT julday mmin 30 dmin ymin hmin mnmin smin :BEGIN more than 30 months ticks every 3 months freq 3 tminor 3 END tempsmax GT julday mmin 16 dmin ymin hmin mnmin smin :BEGIN more than 16 months ticks every 2 months freq 2 tminor 2 END else:BEGIN monthly ticks freq 1 tminor 6 END ENDCASE nticks ceil mmax 12 ymax ymin mmin freq 2 mminf 1 floor mmin freq freq ticknom lonarr nticks for m 0 nticks 1 do ticknom m julday mminf freq m 1 ymin _EXTRA ex datfmt M sep fmtyr ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax nticks END daily base tempsmax GT julday mmin dmin 3 ymin hmin mnmin smin :BEGIN more than 3 days CASE 1 OF tempsmax GT julday mmin dmin 60 ymin hmin mnmin smin :BEGIN more than 60 days ticks every 7 days freq 7 tminor 2 END tempsmax GT julday mmin dmin 30 ymin hmin mnmin smin :BEGIN more than 30 days ticks every 5 days freq 5 tminor 5 END tempsmax GT julday mmin dmin 16 ymin hmin mnmin smin :BEGIN more than 16 days ticks every 2 days freq 2 tminor 2 END ELSE:BEGIN daily ticks freq 1 tminor 2 END ENDCASE nticks ceil tempsmax tempsmin freq 2 dminf 1 floor dmin freq freq ticknom lonarr nticks for d 0 nticks 1 do ticknom d julday mmin dminf freq d ymin _EXTRA ex datfmt D sep M ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax nticks END hourly base tempsmax GT julday mmin dmin ymin hmin 3 mnmin smin :BEGIN more than 3 hours CASE 1 OF tempsmax GT julday mmin dmin ymin hmin 48 mnmin smin :BEGIN more than 48 hours ticks every 6 hours freq 6 tminor 3 datfmt D sep H:00 END tempsmax GT julday mmin dmin ymin hmin 30 mnmin smin :BEGIN more than 30 hours ticks every 4 hours freq 4 tminor 2 datfmt D sep H:00 END tempsmax GT julday mmin dmin ymin hmin 16 mnmin smin :BEGIN more than 16 hours ticks every 2 hours freq 2 tminor 2 datfmt H:00 END ELSE:BEGIN ticks every hour freq 1 tminor 2 datfmt H:00 END ENDCASE nticks ceil hmax 24 dmax dmin hmin freq 2 hminf floor hmin freq freq ticknom dblarr nticks for h 0 nticks 1 do ticknom h julday mmin dmin ymin hminf freq h 0 0 _EXTRA ex ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax nticks END minute base tempsmax GT julday mmin dmin ymin hmin mnmin 3 smin :BEGIN more than 3 minutes CASE 1 OF tempsmax GT julday mmin dmin ymin hmin mnmin 120 smin :BEGIN more than 120 minutes ticks every 10 minutes freq 10 tminor 2 END tempsmax GT julday mmin dmin ymin hmin mnmin 60 smin :BEGIN more than 60 minutes ticks every 6 minutes freq 6 tminor 3 END tempsmax GT julday mmin dmin ymin hmin mnmin 30 smin :BEGIN more than 30 minutes ticks every 4 minutes freq 4 tminor 2 END tempsmax GT julday mmin dmin ymin hmin mnmin 15 smin :BEGIN more than 15 minutes ticks every 2 minutes freq 2 tminor 2 END ELSE:BEGIN ticks every minutes freq 1 tminor 2 END ENDCASE nticks ceil mnmax 60 hmax hmin mnmin freq 2 mnminf floor mnmin freq freq ticknom dblarr nticks for mn 0 nticks 1 do ticknom mn julday mmin dmin ymin hmin mnminf freq mn 0 _EXTRA ex ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax nticks datfmt H: I END second base ELSE:BEGIN less than 3 minutes CASE 1 OF tempsmax GT julday mmin dmin ymin hmin mnmin smin 120 :BEGIN more than 120 seconds ticks every 20 seconds freq 20 tminor 2 datfmt H: I: S END tempsmax GT julday mmin dmin ymin hmin mnmin smin 60 :BEGIN more than 60 seconds ticks every 15 seconds freq 15 tminor 3 datfmt H: I: S END tempsmax GT julday mmin dmin ymin hmin mnmin smin 30 :BEGIN more than 30 seconds ticks every 10 seconds freq 10 tminor 2 datfmt H: I: S END tempsmax GT julday mmin dmin ymin hmin mnmin smin 15 :BEGIN more than 15 seconds ticks every 4 seconds freq 4 tminor 4 datfmt H: I: S END tempsmax GT julday mmin dmin ymin hmin mnmin smin 7 :BEGIN more than 7 seconds ticks every 2 seconds freq 2 tminor 2 datfmt H: I: S END ELSE:BEGIN ticks every minutes freq 1 tminor 2 datfmt H: I: S END ENDCASE nticks ceil smax 60 mnmax mnmin smin freq 2 sminf floor smin freq freq ticknom dblarr nticks for s 0 nticks 1 do ticknom s julday mmin dmin ymin hmin mnmin sminf freq s _EXTRA ex ticknom ticknom where ticknom GE tempsmin AND ticknom LE tempsmax nticks END ENDCASE dummy label_date 0 0 0 DATE_FORMAT datfmt _EXTRA ex if chkstru ex DATE_FORMAT then ex DATE_FORMAT ENDIF Definition of axes parameters case by case case coupe of pltv :BEGIN dtasize tempsmin x range 0 5 dtasize 0 0 5 y range 0 5 dtasize 1 0 5 if keyword_set reverse_x then x range reverse x range if keyword_set reverse_y then y range reverse y range x title nx y title ny END xy :BEGIN if keyword_set reverse_x then x range lon2 lon1 ELSE x range lon1 lon2 if keyword_set reverse_y then y range lat2 lat1 ELSE y range lat1 lat2 IF key_onearth THEN x tickformat lonaxe IF key_onearth THEN y tickformat lataxe END yz :BEGIN if keyword_set reverse_x then x range lat2 lat1 ELSE x range lat1 lat2 if keyword_set reverse_y then y range 0 1 ELSE y range 1 0 if keyword_set sin then BEGIN number of ticks by default plot 0 0 noerase nodata xtick_get xaxe We increase this number to it be around 10 ticks n_elements xaxe 1 ticks ticks 1 2 4 8 ticks ticks sort abs ticks 10 0 We recuperate the x axis for this new number of ticks plot 0 0 xticks ticks noerase nodata xtick_get xaxe x ticks ticks x tickv sin pi 180 xaxe tickname strarr ticks 1 for i 0 ticks do tickname i lataxe 0 0 xaxe i x tickname tickname x range sin pi 180 x range endif end xz :BEGIN if keyword_set reverse_x then x range lon2 lon1 ELSE x range lon1 lon2 if keyword_set reverse_y then y range 0 1 ELSE y range 1 0 end xt : begin if keyword_set reverse_x then x range lon2 lon1 ELSE x range lon1 lon2 if keyword_set reverse_y then y range tempsmax tempsmin tempsmin ELSE y range tempsmin tempsmax tempsmin IF key_onearth THEN x tickformat lonaxe result LABEL_DATE DATE_FORMAT M sep fmtyr y tickformat LABEL_DATE y tickname LABEL_DATE 1 0 ticknom _EXTRA ex y ticklen 1 y gridstyle 2 y ticks nticks 1 y tickv ticknom tempsmin y minor tminor IF divday GT 0 THEN y title Time from strtrim dmin 1 def_month 1m strtrim mmin 1 strtrim ymin 1 end yt : begin if keyword_set reverse_x then x range tempsmax tempsmin tempsmin ELSE x range tempsmin tempsmax tempsmin if keyword_set reverse_y then y range lat2 lat1 ELSE y range lat1 lat2 IF key_onearth THEN y tickformat lataxe x tickname LABEL_DATE 0 0 ticknom _EXTRA ex x ticklen 1 x gridstyle 2 x ticks nticks 1 x tickv ticknom tempsmin x minor tminor IF divday GT 0 THEN y title Time from strtrim dmin 1 def_month 1m strtrim mmin 1 strtrim ymin 1 end zt : begin if keyword_set reverse_x then x range tempsmax tempsmin tempsmin ELSE x range tempsmin tempsmax tempsmin if vargrid EQ W then gdep gdepw 0:nzw 1 ELSE gdep gdept 0:nzt 1 x tickname LABEL_DATE 0 0 ticknom _EXTRA ex x ticklen 1 x gridstyle 2 x ticks nticks 1 x tickv ticknom tempsmin x minor tminor IF divday GT 0 THEN y title Time from strtrim dmin 1 def_month 1m strtrim mmin 1 strtrim ymin 1 end t : BEGIN if keyword_set reverse_x then x range tempsmax tempsmin tempsmin ELSE x range tempsmin tempsmax tempsmin x tickname LABEL_DATE 0 0 ticknom _EXTRA ex x ticklen 1 x gridstyle 2 x ticks nticks 1 x tickv ticknom tempsmin x minor tminor IF divday GT 0 THEN y title Time from strtrim dmin 1 def_month 1m strtrim mmin 1 strtrim ymin 1 end x : begin x range lon1 lon2 IF key_onearth THEN x tickformat lonaxe END y : begin if keyword_set sin then BEGIN Number of ticks by default plot 0 0 nodata noerase xstyle 5 ystyle 5 xtick_get xaxe We increase this number to it be around 10 ticks n_elements xaxe 1 ticks ticks 1 2 4 8 ticks ticks sort abs ticks 10 0 We recuperate the x axis for this new number of ticks plot 0 0 xticks ticks nodata noerase xstyle 5 ystyle 5 xtick_get xaxe x ticks ticks x tickv sin pi 180 xaxe tickname strarr ticks 1 for i 0 ticks do tickname i lataxe 0 0 xaxe i x tickname tickname x range sin pi 180 x range ENDIF ELSE x range lat1 lat2 IF key_onearth THEN x tickformat lataxe END z : begin if vargrid EQ W then gdep gdepw 0:nzw 1 ELSE gdep gdept 0:nzt 1 if keyword_set reverse_y then y range gdep 0 gdep n_elements gdep 1 ELSE y range gdep n_elements gdep 1 gdep 0 END endcase if keyword_set key_performance THEN print temps axe systime 1 tempsun return end"); 292 292 a[290] = new Array("./ToBeReviewed/PLOTS/legende.html", "legende.pro", "", " file_comments Provide caption categories Graphics param MI in required The min of the drawing param MA in required The max of the plot param COUPE type string Character containing two letters giving the type of the cut for example: xz keyword CONTOUR If we want to trace contours of a different field than the one whose we have the colored drawing by example E P in color and QSR in contours It must be a field respecting same characteristics than the argument number one of plt keyword ENDPOINTS Used when we do vertical cuts in diagonal keyword _EXTRA used to pass your keywords uses common pro restrictions The use of the global variable language allows to change the language and the caption easily history Sebastien Masson smasson lodyc jussieu fr 14 8 98 Eric Guilyardi ericg lodyc jussieu fr GB version 11 6 99 version Id: legende pro 163 2006 08 29 12:59:46Z navarro pro legende mi ma coupe CONTOUR contour ENDPOINTS endpoints DIREC direc VECTLEGENDE vectlegende INTERVALLE intervalle TYPE_YZ type_yz VARNAME2 varname2 NPTS npts _EXTRA ex compile_opt idl2 strictarrsubs common tempsun systime 1 pour key_performance grille 1 1 1 gdep nx ny nz English legends fmt_mm f12 2 fmt_bt f7 1 colorf contourf Contour plot vecteurf Vector norm expf datef fieldf depthf endpointsf Diag Section zonalf IF key_onearth THEN latintf latitudes in ELSE latintf j index in timintf time in onf depthf2 Depth m Meridf Zonal Mean IF key_onearth THEN lonintf longitudes in ELSE lonintf i in hovxt XT plot diaghovxt Diag XT plot depintf depths in timef Time hovyt YT plot diaghovyt Diag YT plot hovzt ZT plot hovt IF key_onearth THEN lontitle Longitude ELSE lontitle i index IF key_onearth THEN lattitle Latitude ELSE lattitle j index vertz depthf2 legniv m IF keyword_set TYPE_YZ THEN BEGIN IF type_yz EQ hPa THEN vertz hPa IF type_yz EQ hPa THEN legniv hPa ENDIF Start legende definition and possible complement of p subtitle if n_elements varunit ne 0 then unite varunit else unite p subtitle colorf unite : Min strtrim string format fmt_mm mi 2 Max strtrim string format fmt_mm ma 2 if keyword_set intervalle then BEGIN if intervalle NE 1 then p subtitle p subtitle Int strtrim string format fmt_mm intervalle 2 endif if size contour type EQ 8 then BEGIN it is a structure unite contour 1 p subtitle p subtitle C contourf unite : Min strtrim string format fmt_mm contour 0 0 2 Max strtrim string format fmt_mm contour 0 1 2 if contour inter NE 1 then p subtitle p subtitle Int strtrim string format fmt_mm contour inter 2 ENDIF if size vectlegende type EQ 8 then begin unite vectlegende 1 p subtitle p subtitle C vecteurf unite : Min strtrim string format fmt_mm vectlegende 0 0 2 Max strtrim string format fmt_mm vectlegende 0 1 2 endif Shapping of subdomain s dimensions la1 strtrim string format fmt_bt lat1 2 la2 strtrim string format fmt_bt lat2 2 lo1 strtrim string format fmt_bt lon1 2 lo2 strtrim string format fmt_bt lon2 2 pr1 strtrim string format fmt_bt vert1 2 pr2 strtrim string format fmt_bt vert2 2 Management of the date if n_elements vardate EQ 0 then vardate if NOT keyword_set direc then direc if strpos direc t NE 1 then begin svardate strtrim vairdate time 0 1 strtrim vairdate time jpt 1 1 ENDIF ELSE svardate vardate case on the caes where the caption is applied case coupe of xy :begin if strupcase vargrid EQ W then firstz firstzw ELSE firstz firstzt if strpos direc z EQ 1 AND firstz NE 0 then BEGIN prof strtrim round gdep 0 1 p title expf varexp datef svardate fieldf varname depthf prof legniv ENDIF ELSE p title expf varexp datef svardate fieldf varname x title lontitle y title lattitle end xz :begin IF keyword_set npts THEN n strtrim npts 1 ELSE n strtrim ny 1 IF long n LE 3 THEN zonalf Section if keyword_set endpoints AND lat1 NE lat2 then p title endpointsf varexp datef svardate fieldf varname ELSE p title zonalf varexp datef svardate fieldf varname x title lontitle if keyword_set endpoints AND lat1 EQ lat2 then BEGIN IF key_onearth THEN x title x title at strtrim lataxe 0 0 lat1 1 ELSE x title x title at j index strtrim lat1 1 ENDIF y title depthf2 end yz :begin IF keyword_set npts THEN n strtrim npts 1 ELSE n strtrim nx 1 IF long n LE 3 THEN meridf if keyword_set endpoints AND lon1 NE lon2 then p title endpointsf varexp datef svardate fieldf varname ELSE p title meridf varexp datef svardate fieldf varname y title vertz x title lattitle if keyword_set endpoints AND lon1 EQ lon2 then BEGIN IF key_onearth THEN x title x title at strtrim lonaxe 0 0 lon1 1 ELSE x title x title at i index strtrim lon1 1 ENDIF end xt :begin IF keyword_set npts THEN n strtrim npts 1 if keyword_set endpoints AND lat1 NE lat2 then p title diaghovxt varexp fieldf varname ELSE p title hovxt varexp fieldf varname IF time size time 0 1 time 0 GE 10 THEN y title timef x title lontitle if keyword_set endpoints AND lat1 EQ lat2 then BEGIN IF key_onearth THEN x title x title at strtrim lataxe 0 0 lat1 1 ELSE x title x title at j index strtrim lat1 1 ENDIF end yt :begin IF keyword_set npts THEN n strtrim npts 1 if keyword_set endpoints AND lon1 NE lon2 then p title diaghovyt varexp fieldf varname ELSE p title hovyt varexp fieldf varname IF time size time 0 1 time 0 GE 10 THEN x title timef y title lattitle if keyword_set endpoints AND lon1 EQ lon2 then BEGIN IF key_onearth THEN x title x title at strtrim lonaxe 0 0 lon1 1 ELSE x title x title at i index strtrim lon1 1 ENDIF end zt :begin IF keyword_set npts THEN n strtrim npts 1 ELSE n strtrim nx ny 1 p title hovzt varexp fieldf varname y title depthf2 IF time size time 0 1 time 0 GE 10 THEN x title timef end t :begin IF keyword_set npts THEN n strtrim npts 1 ELSE BEGIN if keyword_set integration3d then n strtrim nx ny nz 1 ELSE n strtrim nx ny 1 ENDELSE p title hovt varexp fieldf varname y title varname IF time size time 0 1 time 0 GE 10 THEN x title timef end x :begin IF keyword_set npts THEN n strtrim npts 1 ELSE n strtrim ny nz 1 if keyword_set endpoints AND lat1 NE lat2 then p title endpointsf varexp datef svardate fieldf varname ELSE p title varexp datef svardate fieldf varname x title lontitle if keyword_set endpoints AND lat1 EQ lat2 then BEGIN IF key_onearth THEN x title x title at strtrim lataxe 0 0 lat1 1 ELSE x title x title at j index strtrim lat1 1 ENDIF y title varname end y :begin IF keyword_set npts THEN n strtrim npts 1 ELSE n strtrim nx nz 1 if keyword_set endpoints AND lon1 NE lon2 then p title endpointsf varexp datef svardate fieldf varname ELSE p title varexp datef svardate fieldf varname x title lattitle if keyword_set endpoints AND lon1 EQ lon2 then BEGIN IF key_onearth THEN x title x title at strtrim lonaxe 0 0 lon1 1 ELSE x title x title at i index strtrim lon1 1 ENDIF y title varname end z :begin IF keyword_set npts THEN n strtrim npts 1 ELSE n strtrim nx ny 1 p title varexp datef svardate fieldf varname y title depthf2 x title varname end yfx : BEGIN IF keyword_set npts THEN n strtrim npts 1 ELSE n strtrim nx ny nz 1 p title varexp datef svardate varunit x title varname2 y title varname END else: ENDCASE if keyword_set direc then BEGIN if strpos direc x NE 1 then p subtitle lonintf lo1 lo2 onf strtrim nx 1 points C p subtitle if strpos direc y NE 1 then BEGIN if strpos p subtitle EQ 1 then p subtitle latintf la1 la2 onf strtrim ny 1 points C p subtitle ELSE p subtitle latintf la1 la2 onf strtrim ny 1 points p subtitle ENDIF if strpos direc z NE 1 AND nz NE 1 OR coupe NE xy then BEGIN if strpos p subtitle EQ 1 then p subtitle depintf pr1 pr2 onf strtrim nz 1 points C p subtitle ELSE p subtitle depintf pr1 pr2 onf strtrim nz 1 points p subtitle ENDIF ENDIF if keyword_set endpoints AND coupe NE yt AND lat1 NE lat2 then p title p title C C if keyword_set key_performance THEN print temps legende systime 1 tempsun return end"); 293 293 a[291] = new Array("./ToBeReviewed/PLOTS/plotsym.html", "plotsym.pro", "", " file_comments function to make plotting symbols much easier categories Graphics Keyword circle circle symbol Keyword TRIANGLE triangle symbol Keyword DIAMOND diamond symbol Keyword BOX box symbol Keyword LINE line symbol Keyword SCALE scales the symbol Keyword ANGLE angle the symbol should be rotated Keyword _EXTRA extra keywords for usersym These are thick color and fill history Written by: Ronn Kling Ronn Kling Consulting 7038 Westmoreland Dr Warrenton VA 20187 klingrl juno com copyright 1999 all rights reserved version Id: plotsym pro 163 2006 08 29 12:59:46Z navarro function plotsym circle circle triangle triangle diamond diamond angle angle box box line line scale scale _extra extra compile_opt idl2 strictarrsubs if not keyword_set scale then scale 1 0 if not keyword_set angle then angle 0 0 if keyword_set circle then begin theta findgen 30 29 360 endif else if keyword_set triangle then begin theta 30 90 210 30 endif else if keyword_set diamond then begin theta 0 90 180 270 0 endif else if keyword_set box then begin theta 315 45 135 225 315 endif else if keyword_set line then begin theta 180 0 endif theta theta angle x cos theta dtor scale y sin theta dtor scale usersym x y _extra extra return 8 end"); … … 333 333 a[331] = new Array("./ToBeReviewed/TRIANGULATION/fillcornermask.html", "fillcornermask.pro", "", " file_comments To color cleanly continents categories Graphics keyword _EXTRA Used to pass your keywords keyword CONT_COLOR default d n_colors 1 white The color of the continent uses common pro history Sebastien Masson smasson lodyc jussieu fr 8 8 2002 version Id: fillcornermask pro 163 2006 08 29 12:59:46Z navarro PRO fillcornermask xin yin COINMONTE coinmonte COINDESCEND coindescend CONT_COLOR cont_color INDICEZOOM indicezoom _extra ex compile_opt idl2 strictarrsubs common if NOT keyword_set coinmonte AND NOT keyword_set coindescend then return tempsun systime 1 For key_performance IF NOT keyword_set cont_color THEN cont_color d n_colors 1 255 definition of coordinates of points numbered 1 2 3 4 5 6 see figures below x1 reform xin y1 reform yin IF size x1 0 EQ 2 THEN x1 x1 0 IF size y1 0 EQ 2 THEN y1 y1 0 x2 5 x1 shift x1 1 y2 5 y1 shift y1 1 nx n_elements x1 ny n_elements y1 Case land corner in ascent: 2 land points in diagonal ascending with 2 ocean points on the descendant diagonal 3 t i nx 1 u i nx t i nx 1 0 1 4 v i f i v i 1 t i 0 2 u i t i 1 1 if keyword_set coinmonte then BEGIN if coinmonte 0 NE 1 then BEGIN iup coinmonte MOD nx jup coinmonte nx for id 0 n_elements coinmonte 1 do BEGIN i iup id j jup id IF i NE nx 1 AND j NE ny 1 THEN BEGIN polyfill x1 i x2 i x2 i x1 i 1 x1 i y2 j y1 j y1 j 1 y2 j y2 j color cont_color _extra ex ENDIF endfor endif endif Case land corner in descent: 2 land points in diagonal descending with 2 ocean points on the ascendant diagonal 4 t i nx 1 u i nx t i nx 1 0 3 5 v i f i v i 1 1 t i 0 2 u i t i 1 1 if keyword_set coindescend then BEGIN if coindescend 0 NE 1 then begin idw coindescend MOD nx jdw coindescend nx for id 0 n_elements coindescend 1 do BEGIN i idw id j jdw id IF i NE nx 1 AND j NE ny 1 THEN BEGIN polyfill x1 i x2 i x2 i x1 i 1 x1 i y2 j y1 j 1 y1 j y2 j y2 j color cont_color _extra ex ENDIF endfor endif endif IF keyword_set key_performance THEN print temps fillcornermask systime 1 tempsun return end"); 334 334 a[332] = new Array("./ToBeReviewed/TRIANGULATION/section.html", "section.pro", "", " file_comments categories param FIELD param RES param GLAMAXE param GPHIAXE keyword ENDPOINTS keyword BOXZOOM keyword TYPE keyword WDEPTH keyword DIREC keyword SHOWBUILD keyword ONLYBOX keyword _EXTRA Used to pass your keywords returns uses common pro restrictions examples history Sebastien Masson smasson lodyc jussieu fr version Id: section pro 186 2006 09 20 10:50:37Z pinsard PRO section field res glamaxe gphiaxe ENDPOINTS endpoints BOXZOOM boxzoom TYPE type WDEPTH wdepth DIREC direc SHOWBUILD showbuild ONLYBOX onlybox _extra ex include common compile_opt idl2 strictarrsubs cm_4mesh cm_4data cm_4cal IF NOT keyword_set key_forgetold THEN BEGIN updatenew updatekwd ENDIF definition of boxzoom in function of endpoints then redefinition of the domain boxzoom2d min endpoints 0 endpoints 2 max ma02 ma02 min endpoints 1 endpoints 3 max ma13 ma13 minprof 0 profdefault 200 if n_elements type EQ 0 then type nothing Case N_Elements Boxzoom OF 0:localbox boxzoom2d minprof profdefault 1:localbox boxzoom2d minprof boxzoom 0 2:localbox boxzoom2d boxzoom 0 4:if strpos type z NE 1 THEN localbox boxzoom2d minprof profdefault ELSE localbox boxzoom2d 5:localbox boxzoom2d minprof boxzoom 4 6:localbox boxzoom2d boxzoom 4:5 Else:BEGIN print report Bad definition of the box stop END ENDCASE nelbox n_elements localbox if keyword_set wdepth then grillechoice vargrid W ELSE grillechoice vargrid domdef localbox GRIDTYPE grillechoice findalways _extra ex grille 1 1 1 1 nx ny if less than 10 points where found we apply domdef over the whole domain problem why 10 points as a test value how can we find a good test value IF nx ny LE 10 THEN domdef GRIDTYPE grillechoice _extra ex We redefine lon1 in case findalways has been used in domdef lon1 min endpoints 0 endpoints 2 max lon2 lat1 min endpoints 1 endpoints 3 max lat2 we extend the box along the z axis i that way the plot will be drawn until its bottom part if strpos type z NE 1 THEN BEGIN We keep yranges axis z before changing the boxzoom y range localbox nelbox 1 localbox nelbox 2 if vargrid EQ W OR keyword_set wdepth then BEGIN firstzw 0 firstzw 1 lastzw lastzw 1 firstzt 1 lastzt lastzt 1 firstx 1 lastx lastx 1 firsty 1 lasty lasty 1 jpj 1 domdef firstx lastx firsty lasty firstz lastz index gridtype vargrid IF keyword_set onlybox THEN return grille mask glam gphi gdep nx ny nz firstx firsty firstz lastx lasty lastz We define the triangulation which will allows us to determinate the section We recalculate it because it must be defined on the Earth and on oceans Following the direction of the section rather longitude or rather latitude we define the way to triangulate if strpos type x NE 1 then BEGIN downward lindgen nx ny 0:nx 2 0:ny 2 tri definetri nx ny downward ENDIF ELSE tri definetri nx ny If we have an irregular grid that is periodic then it is possible that some of the triangle have a very large size neighborg points on the sphere but far away when doing the projection and should not be taken into account IF keyword_set key_irregular AND keyword_set key_periodic THEN BEGIN glamtri glam tri glamtri abs glamtri shift glamtri 1 0 good temporary glamtri LT 10 max glam nx good where total temporary good 1 EQ 3 tri temporary tri temporary good ENDIF Equation of the line on which we do the section abc linearequation endpoints 0:1 endpoints 2:3 glamtri glam tri gphitri gphi tri Which points of the triangulation are above and below the line if abc 1 NE 0 THEN test temporary gphitri GE abc 0 abc 1 temporary glamtri abc 2 abc 1 ELSE test temporary glamtri GE abc 1 abc 0 temporary gphitri abc 2 abc 0 zero123 total test 1 to keep: triangles of the triangulation which are over the line tokeep1 where zero123 EQ 1 tokeep2 where temporary zero123 EQ 2 tokeep tokeep1 tokeep2 test test tokeep tri tri tokeep Which summit of the triangle is alone in a side of the line single1 where test 0:n_elements tokeep1 1 EQ 1 single1 single1 single1 3 3 single2 where test n_elements tokeep1 :n_elements tokeep 1 EQ 0 single2 single2 single2 3 3 undefine tokeep undefine tokeep1 undefine tokeep2 undefine test single temporary single1 temporary single2 points1 the point of the triangle alone in a side of the line point2 the other point of the triangle in the other side of the line point1 single single point2 single EQ 0 1 single LE 1 undefine single ntri size tri 2 index lindgen ntri lindgen ntri points1 tri point1 index points2 tri point2 temporary index points : complex containing couples of points in a side and the other side of the line We have to delete duplicates points dcomplex points1 points2 points points uniq points sort points symetrique dcomplex imaginary points double points points points where points shift temporary symetrique 1 NE 0 points1 coordinates of the point of the triangle which is alone in a side of the line point2 coordinates of the other point of the triangle in the other side of the line points1 complex glam double points gphi double points points2 complex glam imaginary points gphi imaginary points droites equations of line whose we look for the intersection wit the section droites linearequation points1 points2 inter lineintersection droites abc replicate 1 n_elements points1 Geographic coordinates of points we look for on the section glamaxe float inter gphiaxe imaginary inter We arrange them in the growing order between boundaries of the section if strpos type x NE 1 then BEGIN sort sort glamaxe glamaxe glamaxe sort inbox where glamaxe GE lon1 AND glamaxe LE lon2 glamaxe glamaxe inbox sort sort inbox gphiaxe gphiaxe sort ENDIF ELSE BEGIN sort sort gphiaxe gphiaxe gphiaxe sort inbox where gphiaxe GE lat1 AND gphiaxe LE lat2 gphiaxe gphiaxe inbox sort sort inbox glamaxe glamaxe sort ENDELSE points points sort points1 points1 sort points2 points2 sort inter inter sort poids abs points2 inter abs points2 points1 array litchamp field array fitintobox array if array 0 EQ 1 THEN BEGIN res 1 return ENDIF if n_elements valmask EQ 0 THEN valmask 1e20 taille size array if jpt GT 1 AND taille 0 GE 3 AND strpos type t EQ 1 then BEGIN direc t array grossemoyenne array t taille size array jpt 1 ENDIF case 1 of xy taille 0 EQ 2:BEGIN value1 array double points terre where value1 GT valmask 10 if terre 0 NE 1 then value1 terre values f_nan value2 array imaginary points terre where value2 GT valmask 10 if terre 0 NE 1 then value2 terre values f_nan res poids value1 1 poids value2 END xyz taille 0 EQ 3 AND jpt EQ 1:BEGIN npoints n_elements points index double points replicate 1 nz replicate nx ny npoints lindgen nz value1 array index terre where value1 GT valmask 10 if terre 0 NE 1 then value1 terre values f_nan index imaginary points replicate 1 nz replicate nx ny npoints lindgen nz value2 array index terre where value2 GT valmask 10 if terre 0 NE 1 then value2 terre values f_nan poids poids replicate 1 nz res poids value1 1 poids value2 average following z if strpos type z EQ 1 then begin nan where finite res EQ 0 if vargrid EQ W then e3 e3w firstzw:lastzw ELSE e3 e3t firstzt:lastzt weight replicate 1 npoints e3 if nan 0 NE 1 then weight nan values f_nan totalweight total weight 2 nan zero where totalweight EQ 0 if zero 0 NE 1 then totalweight zero values f_nan res total res weight 2 nan totalweight direc z string byte testvar var toto endif END xyt taille 0 EQ 3 AND jpt NE 1:BEGIN npoints n_elements points index double points replicate 1 jpt replicate nx ny npoints lindgen jpt value1 array index terre where value1 GT valmask 10 if terre 0 NE 1 then value1 terre values f_nan index imaginary points replicate 1 jpt replicate nx ny npoints lindgen jpt value2 array index terre where value2 GT valmask 10 if terre 0 NE 1 then value2 terre values f_nan poids poids replicate 1 jpt res poids value1 1 poids value2 END xyzt taille 0 EQ 4:BEGIN npoints n_elements points index double points replicate 1 nz jpt replicate nx ny npoints lindgen nz jpt index reform index npoints nz jpt over value1 array index terre where value1 GT valmask 10 if terre 0 NE 1 then value1 terre values f_nan index imaginary points replicate 1 nz jpt replicate nx ny npoints lindgen nz jpt index reform index npoints nz jpt over value2 array index terre where value2 GT valmask 10 if terre 0 NE 1 then value2 terre values f_nan poids poids replicate 1 nz jpt poids reform poids npoints nz jpt over res poids value1 1 poids value2 average following z if strpos type z EQ 1 then begin nan where finite res EQ 0 if vargrid EQ W then e3 e3w firstzw:lastzw ELSE e3 e3t firstzt:lastzt weight replicate 1 npoints e3 weight weight replicate 1 jpt weight reform weight npoints nz jpt over if nan 0 NE 1 then weight nan values f_nan totalweight total weight 2 nan zero where totalweight EQ 0 if zero 0 NE 1 then totalweight zero values f_nan res total res weight 2 nan totalweight direc z string byte testvar var toto endif END endcase terre where finite res EQ 0 if terre 0 NE 1 then res terre valmask if n_elements showbuild then BEGIN winsave window psave p xsave x ysave y plt findgen nx ny nodata nofill rempli title subtitle coast_thick 2 window showbuild p title p subtitle plots endpoints 0 endpoints 2 endpoints 1 endpoints 3 color 50 plots endpoints 0 endpoints 2 endpoints 1 endpoints 3 color 50 psym 2 thick 2 FOR i 0 n_elements points1 1 DO plots float points1 i float points2 i imaginary points1 i imaginary points2 i color 150 plots float points1 imaginary points1 color 150 psym 1 plots float points2 imaginary points2 color 150 psym 1 plots float inter imaginary inter color 250 psym 1 bug IF terre 0 NE 1 THEN plots float terre inter imaginary terre inter color 0 psym 1 dummy read dummy prompt press return to continue IF d name EQ PS THEN erase ELSE wset winsave p psave x xsave y ysave ENDIF restoreboxparam boxparam4section dat return end"); 335 a[333] = new Array("./ToBeReviewed/TRIANGULATION/tracecote.html", "tracecote.pro", "", " file_comments Draw coasts in plt categories Graphics keyword SURFACE_COASTLINE To draw the surface coast line instead of the coast line at level firstz tw Useful only for deep plots keyword _EXTRA used to pass your keywords uses common pro history Sebastien Masson smasson lodyc jussieu fr 30 9 1999 version Id: tracecote pro 163 2006 08 29 12:59:46Z navarro PRO tracecote SURFACE_COASTLINE surface_coastline _EXTRA ex include commons compile_opt idl2 strictarrsubs cm_4data cm_4mesh IF NOT keyword_set key_forgetold THEN BEGIN updatenew ENDIF tempsun systime 1 For key_performance if n_elements key_gridtype EQ 0 then key_gridtype c We enlarge a bit the frame defined by firsts lasts in order to recuperate edges of the coast which are in the edging of the domain tempdeux systime 1 For key_performance 2 firstx 0 min firstxt firstxf 1 lastx max lastxt lastxf 1 min firstyt firstyf 1 lasty max lastyt lastyf 1 jpj 1 nx lastx firstx 1 ny lasty firsty 1 Which vertical level choose IF keyword_set surface_coastline THEN firstz 0 ELSE IF strupcase vargrid eq W THEN firstz firstzw ELSE firstz firstzt Attribution of the mask and of coordinates delimiting limits of the land coordinates f mask tmask firstx:lastx firsty:lasty firstz xf glamf firstx:lastx firsty:lasty yf gphif firstx:lastx firsty:lasty IF testvar var key_performance EQ 2 THEN print temps tracecote: determiner mask xf yf systime 1 tempdeux if key_gridtype EQ e then onemore xf 0 0 gT xf 0 1 We pass in normalized coordinates to be able to become independant from the projection s type choosen and from the support on which we do the drawing screen or postscript z convert_coord xf yf data to_normal xf reform z 0 nx ny yf reform z 1 nx ny tempvar SIZE TEMPORARY z Beware following the projection some points x or y can become NaN see point behind the earth in an orthographic projection We put points to be eliminated at a very big value so that they will not pass the test with distanceseuil see further if map projection LE 7 AND map projection NE 0 OR map projection EQ 14 OR map projection EQ 15 OR map projection EQ 18 then begin ind where finite xf yf EQ 0 IF ind 0 NE 1 THEN BEGIN xf ind 1e5 yf ind 1e5 ENDIF ENDIF ind where xf LT p position 0 OR xf GT p position 2 IF ind 0 NE 1 THEN xf ind 1e5 ind where yf LT p position 1 OR yf GT p position 3 IF ind 0 NE 1 THEN yf ind 1e5 tempvar SIZE TEMPORARY ind we delete ind if n_elements key_gridtype EQ 0 then key_gridtype c case key_gridtypeof c :drawcoast_c mask xf yf nx ny _extra ex e :drawcoast_e mask xf yf nx ny onemore onemore _extra ex endcase if keyword_set key_performance THEN print temps tracecote systime 1 tempsun return end");335 a[333] = new Array("./ToBeReviewed/TRIANGULATION/tracecote.html", "tracecote.pro", "", " file_comments Draw coasts in plt categories Graphics keyword SURFACE_COASTLINE To draw the surface coast line instead of the coast line at level firstz tw Useful only for deep plots keyword _EXTRA used to pass your keywords uses common pro history Sebastien Masson smasson lodyc jussieu fr 30 9 1999 version Id: tracecote pro 209 2007 02 08 10:01:49Z smasson PRO tracecote SURFACE_COASTLINE surface_coastline _EXTRA ex include commons compile_opt idl2 strictarrsubs cm_4data cm_4mesh IF NOT keyword_set key_forgetold THEN BEGIN updatenew ENDIF tempsun systime 1 For key_performance if n_elements key_gridtype EQ 0 then key_gridtype c We enlarge a bit the frame defined by firsts lasts in order to recuperate edges of the coast which are in the edging of the domain tempdeux systime 1 For key_performance 2 firstx 0 min firstxt firstxf 1 lastx max lastxt lastxf 1 min firstyt firstyf 1 lasty max lastyt lastyf 1 jpj 1 nx lastx firstx 1 ny lasty firsty 1 Which vertical level choose IF keyword_set surface_coastline THEN firstz 0 ELSE IF strupcase vargrid eq W THEN firstz firstzw ELSE firstz firstzt Attribution of the mask and of coordinates delimiting limits of the land coordinates f mask tmask firstx:lastx firsty:lasty firstz xf glamf firstx:lastx firsty:lasty yf gphif firstx:lastx firsty:lasty IF testvar var key_performance EQ 2 THEN print temps tracecote: determiner mask xf yf systime 1 tempdeux if key_gridtype EQ e then onemore xf 0 0 gT xf 0 1 We pass in normalized coordinates to be able to become independant from the projection s type choosen and from the support on which we do the drawing screen or postscript z convert_coord xf yf data to_normal xf reform z 0 nx ny yf reform z 1 nx ny tempvar SIZE TEMPORARY z Beware following the projection some points x or y can become NaN see point behind the earth in an orthographic projection We put points to be eliminated at a very big value so that they will not pass the test with distanceseuil see further if map projection LE 7 AND map projection NE 0 OR map projection EQ 14 OR map projection EQ 15 OR map projection EQ 18 then begin ind where finite xf yf EQ 0 IF ind 0 NE 1 THEN BEGIN xf ind 1e5 yf ind 1e5 ENDIF ENDIF ind where xf LT p position 0 OR xf GT p position 2 IF ind 0 NE 1 THEN xf ind 1e5 ind where yf LT p position 1 OR yf GT p position 3 IF ind 0 NE 1 THEN yf ind 1e5 tempvar SIZE TEMPORARY ind we delete ind case strmid key_gridtype 0 1 of c :drawcoast_c mask xf yf nx ny _extra ex e :drawcoast_e mask xf yf nx ny onemore onemore _extra ex endcase if keyword_set key_performance THEN print temps tracecote systime 1 tempsun return end"); 336 336 a[334] = new Array("./ToBeReviewed/TRIANGULATION/tracemask.html", "tracemask.pro", "", " file_comments Draw contours of a mask categories Utilities param MASKENTREE in required 2d array specifying the mask param XIN in required 2d array specifying longitude coordinates param YIN in required 2d array specifying latitude coordinates keyword COAST_COLOR default 0 The color of the coastline Default is black 0 keyword COAST_THICK default 1 The thick of the trait to trace continents keyword OVERPLOT To do a plot over an other one keyword _EXTRA used to pass your keywords uses common pro history Sebastien Masson smasson lodyc jussieu fr version Id: tracemask pro 163 2006 08 29 12:59:46Z navarro PRO tracemask maskentree xin yin COAST_COLOR coast_color COAST_THICK coast_thick OVERPLOT overplot _extra ex compile_opt idl2 strictarrsubs if keyword_set overplot then return cm_general IF NOT keyword_set key_forgetold THEN BEGIN updatekwd ENDIF tempsun systime 1 For key_performance We avoid edging problems: tempdeux systime 1 For key_performance 2 tailleentree size maskentree nx tailleentree 1 1 ny tailleentree 2 1 we check the input axis IF n_elements xin EQ 0 THEN xentree findgen nx 1 ELSE xentree xin IF size xentree 0 EQ 1 THEN xentree xentree replicate 1 ny 1 IF n_elements yin EQ 0 THEN yentree findgen ny 1 ELSE yentree yin IF size yentree 0 EQ 1 THEN yentree replicate 1 nx 1 yentree We enlarge the mask by 1 column to the left an d1 line to the bottom mask intarr tailleentree 1 1 tailleentree 2 1 mask 1:tailleentree 1 1:tailleentree 2 maskentree The 2 first columns are identical mask 0 1:tailleentree 2 maskentree 0 The 2 first lines are identical mask 1:tailleentree 1 0 maskentree 0 We calculate the position following x of points which will serve to trace the mask They are situated between each points of the mask exept for the last column we can not calculate and so we put at max x range xrange x range sort x range if REVERSE_X is used xentree 5 xentree shift xentree 1 0 IF not keyword_set overplot THEN xentree nx 2 xrange 1 ELSE xentree nx 2 xentree nx 3 we sill xentree xrange 0 xentree yentree yrange 1 yf fltarr nx ny yf 1:nx 1 1:ny 1 yentree yf 0 1:ny 1 yentree 0 IF not keyword_set overplot THEN BEGIN if yinverse then yf 0 yrange 1 ELSE yf 0 yrange 0 ENDIF ELSE yentree 0 yentree 1 IF testvar var key_performance EQ 2 THEN print temps tracemask: determination du mask et des ses coordonnes systime 1 tempdeux We trace vertical segments: tempdeux systime 1 For key_performance 2 liste where mask shift mask 1 0 EQ 1 IF liste 0 NE 1 THEN BEGIN We recuperate lx and ly which are indexes in a 2d array of points given by list ly liste nx lx temporary liste nx ly indice where ly NE 0 We do not take points concernining the first line because in this case the point j 1 is not defined if indice 0 NE 1 then begin lx lx indice ly ly temporary indice IF testvar var key_performance EQ 2 THEN print temps tracemask: liste traits verticaux systime 1 tempdeux tempdeux systime 1 For key_performance 2 loop on concerned points and drawing of the segment comments: we use plots instead of plot because plots is faster for pt 0L n_elements lx 1 do BEGIN i lx pt j ly pt plots xf i j 1 xf i j yf i j 1 yf i j color coast_color thick coast_thick _extra ex if pt LT 5 then begin endif endfor IF testvar var key_performance EQ 2 THEN print temps tracemask: trace traits verticaux systime 1 tempdeux endif ENDIF We trace horizontal segments: tempdeux systime 1 For key_performance 2 liste where mask shift mask 0 1 EQ 1 IF liste 0 NE 1 THEN BEGIN ly liste nx lx temporary liste nx ly indice where lx NE 0 We do not take point sof the first column if indice 0 EQ 1 then return lx lx indice ly ly temporary indice IF testvar var key_performance EQ 2 THEN print temps tracemask: liste traits horizontaux systime 1 tempdeux tempdeux systime 1 For key_performance 2 for pt 0L n_elements lx 1 do BEGIN i lx pt j ly pt plots xf i 1 j xf i j yf i 1 j yf i j color coast_color thick coast_thick _extra ex endfor IF testvar var key_performance EQ 2 THEN print temps tracemask: trace traits horizontaux systime 1 tempdeux endif if keyword_set key_performance THEN print temps tracemask systime 1 tempsun return end "); 337 a[335] = new Array("./ToBeReviewed/TRIANGULATION/triangule.html", "triangule.pro", "", " file_comments categories param MASKENTREE in optional type 2d array It is a 2d array which will serve to mask the field we will trace after with CONTOUR TRIANGULATION triangule mask If this argument is not specified the function use tmask keyword BASIC Specify that the mask is on a basic grid use the triangulation for vertical cuts and hovmoellers keyword COINMONTE type array To obtain the array of ascending land corner to be treated with completecointerre pro in the variable array instead of make it pass by the global variable twin_corners_up keyword COINDESCEND type array See COINMONTE keyword _EXTRA Used to pass your keywords returns uses restrictions examples history version Id: triangule pro 163 2006 08 29 12:59:46Z navarro todo seb FUNCTION triangule maskentree BASIC basic COINMONTE coinmonte COINDESCEND coindescend _extra ex compile_opt idl2 strictarrsubs common szmsk size maskentree IF szmsk 0 EQ 0 THEN BEGIN nx jpi ny jpj ENDIF ELSE BEGIN nx szmsk 1 ny szmsk 2 ENDELSE IF nx EQ 1 OR ny EQ 1 THEN return 1 IF arg_present coinmonte THEN coinmonte 1 IF arg_present coindescend THEN coindescend 1 if keyword_set basic then return triangule_c maskentree BASIC COINMONTE coinmonte COINDESCEND coindescend _extra ex if n_elements key_gridtype EQ 0 then key_gridtype c if n_elements maskentree EQ 0 then maskentree tmask 0 case key_gridtypeof e :res triangule_e maskentree _extra ex c :res triangule_c maskentree COINMONTE coinmonte COINDESCEND coindescend _extra ex endcase return res end");337 a[335] = new Array("./ToBeReviewed/TRIANGULATION/triangule.html", "triangule.pro", "", " file_comments categories param MASKENTREE in optional type 2d array It is a 2d array which will serve to mask the field we will trace after with CONTOUR TRIANGULATION triangule mask If this argument is not specified the function use tmask keyword BASIC Specify that the mask is on a basic grid use the triangulation for vertical cuts and hovmoellers keyword COINMONTE type array To obtain the array of ascending land corner to be treated with completecointerre pro in the variable array instead of make it pass by the global variable twin_corners_up keyword COINDESCEND type array See COINMONTE keyword _EXTRA Used to pass your keywords returns uses restrictions examples history version Id: triangule pro 209 2007 02 08 10:01:49Z smasson todo seb FUNCTION triangule maskentree BASIC basic COINMONTE coinmonte COINDESCEND coindescend _extra ex compile_opt idl2 strictarrsubs common szmsk size maskentree IF szmsk 0 EQ 0 THEN BEGIN nx jpi ny jpj ENDIF ELSE BEGIN nx szmsk 1 ny szmsk 2 ENDELSE IF nx EQ 1 OR ny EQ 1 THEN return 1 IF arg_present coinmonte THEN coinmonte 1 IF arg_present coindescend THEN coindescend 1 if keyword_set basic then return triangule_c maskentree BASIC COINMONTE coinmonte COINDESCEND coindescend _extra ex if n_elements key_gridtype EQ 0 then key_gridtype c if n_elements maskentree EQ 0 then maskentree tmask 0 case strmid key_gridtype 0 1 of e :res triangule_e maskentree _extra ex c :res triangule_c maskentree COINMONTE coinmonte COINDESCEND coindescend _extra ex endcase return res end"); 338 338 a[336] = new Array("./ToBeReviewed/TRIANGULATION/triangule_c.html", "triangule_c.pro", "", " file_comments Construct the triangulation array The idea is: construct a list of triangle which link points between them This is automatically done by the function TRIANGULATE Here: we consider the fact that points are disposed on a grid regular or not but not unstructured that is to say that points are written following a rectangular matrix A easy way to do triangles between all points is then: for each point i j of the matrix except those of the last line and of the last column we call rectangle i j the rectangle made of the four points i j i 1 j i j 1 i 1 j 1 To trace all triangle we just have to trace the 2 triangles contained in rectangles i j We notice that each rectangle i j have 2 diagonals it is true Make a drawing to make sure so there are two possible choice for each rectangle we want to cut in 2 triangles It is thanks to this choice that we will be able to trace coast with right angles At each angle of coast remarkable by the existence of an unique land point or of an unique ocean point on one of the four summit of a rectangle i j we have to cut the rectangle following the diagonal passing by this point categories Graphics param MASKENTREE in optional type 2d array It is a 2d array which will serve to mask the field we will trace after with CONTOUR TRIANGULATION triangule mask If this argument is not specified the function use tmask keyword BASIC Specify that the mask is on a basic grid use the triangulation for vertical cuts and hovmoellers keyword KEEP_CONT To keep the triangulation even on the continents keyword COINMONTE type array To obtain the array of ascending land corner to be treated with completecointerre pro in the variable array instead of make it pass by the global variable twin_corners_up keyword COINDESCEND type array See COINMONTE returns res: tableau 2d 3 nbre de triangles Each line of res represent indexes of points constituting summits of a triangle See how we trace triangles in definetri pro uses common pro different pro definetri pro restrictions Datas whose we want to do the contour must be disposed in a matrix On the other hand in the matrix the points s arrangement can not be irregular If it is use TRIANGULE history Sebastien Masson smasson lodyc jussieu fr 26 4 1999 version Id: triangule_c pro 163 2006 08 29 12:59:46Z navarro todo seb L 267 268 je ne pense pas que ce soit ce que tu voulais dire mais c est la traduction de ce qu il y avait crit Correction si besoin FUNCTION triangule_c maskentree COINMONTE coinmonte COINDESCEND coindescend BASIC basic KEEP_CONT keep_cont compile_opt idl2 strictarrsubs tempsun systime 1 For key_performance cm_4mesh IF NOT keyword_set key_forgetold THEN BEGIN updatenew ENDIF Is the mask given or do we have to take tmask msk maskentree taille size msk nx taille 1 ny taille 2 IF n_elements keep_cont EQ 0 THEN keep_cont 1 key_irregular if keyword_set key_periodic nx EQ jpi AND NOT keyword_set basic then BEGIN msk msk msk 0 nx nx 1 ENDIF We will find the list of rectangles i j located by their left bottom corner we have to cut folowing a descendant diagonal We will call this list : pts_downward pts_downward 0 We construct the test which allow to find this triangle : shift msk 0 1 shift msk 1 1 msk shift msk 1 0 sum1 msk shift msk 1 0 shift msk 1 1 points which surround the left top point sum2 msk shift msk 0 1 shift msk 1 1 points which surround the right bottom point tempdeux systime 1 For key_performance 2 The left top land point surrounded by ocean points liste where 4 sum1 1 shift msk 0 1 EQ 1 if liste 0 NE 1 THEN pts_downward pts_downward liste The left top ocean point surrounded by land points liste where 1 sum1 shift msk 0 1 EQ 1 if liste 0 NE 1 THEN pts_downward pts_downward liste The right bottom land point surrounded by ocean points liste where 4 sum2 1 shift msk 1 0 EQ 1 if liste 0 NE 1 THEN pts_downward pts_downward liste The right bottom ocean point surrounded by land points liste where 1 sum2 shift msk 1 0 EQ 1 if liste 0 NE 1 THEN pts_downward pts_downward liste undefine liste IF testvar var key_performance EQ 2 THEN print temps triangule: trouver pts_downward systime 1 tempdeux if NOT keyword_set basic OR keyword_set coinmonte OR keyword_set coindescend then begin tempdeux systime 1 For key_performance 2 2 land points in ascendant diagonal with 2 ocean points in descendant diagonal coinmont where 1 msk 1 shift msk 1 1 shift msk 0 1 shift msk 1 0 EQ 1 if coinmont 0 NE 1 THEN pts_downward pts_downward coinmont IF testvar var key_performance EQ 2 THEN print temps triangule: trouver coinmont systime 1 tempdeux tempdeux systime 1 pour key_performance 2 coindesc where 1 shift msk 0 1 1 shift msk 1 0 msk shift msk 1 1 EQ 1 2 land points in descendant diagonal with 2 ocean points in ascendant diagonal IF testvar var key_performance EQ 2 THEN print temps triangule: trouver coindesc systime 1 tempdeux ENDIF if n_elements pts_downward EQ 1 then BEGIN tempdeux systime 1 For key_performance 2 triang definetri nx ny IF testvar var key_performance EQ 2 THEN print temps triangule: definetri systime 1 tempdeux coinmont 1 coindesc 1 ENDIF ELSE BEGIN tempdeux systime 1 For key_performance 2 pts_downward pts_downward 1:n_elements pts_downward 1 pts_downward pts_downward uniq pts_downward sort pts_downward None rectangle can have an element of the last column or of the last line as left bottom corner so we have to remove these points if they has been selected in pts_downward derniere_colonne lindgen ny 1 nx 1 derniere_ligne lindgen nx ny 1 nx pts_downward different pts_downward derniere_colonne pts_downward different pts_downward derniere_ligne if NOT keyword_set basic OR keyword_set coinmonte OR keyword_set coindescend then begin if coinmont 0 NE 1 then begin coinmont different coinmont derniere_colonne coinmont different coinmont derniere_ligne endif if coindesc 0 NE 1 then begin coindesc different coindesc derniere_colonne coindesc different coindesc derniere_ligne endif ENDIF ELSE BEGIN coinmont 1 coindesc 1 ENDELSE IF testvar var key_performance EQ 2 THEN print temps triangule: menage ds pts_downward coinmont et coindesc systime 1 tempdeux tempdeux systime 1 For key_performance 2 if pts_downward 0 EQ 1 then triang definetri nx ny ELSE triang definetri nx ny pts_downward IF testvar var key_performance EQ 2 THEN print temps triangule: definetri systime 1 tempdeux ENDELSE We delete land points which only contain land points if NOT keyword_set basic AND NOT keyword_set keep_cont then begin tempdeux systime 1 For key_performance 2 We delete rectangles which are entirely in the land recdsterre where 1 msk 1 shift msk 1 0 1 shift msk 0 1 1 shift msk 1 1 EQ 1 IF testvar var key_performance EQ 2 THEN print temps triangule: tous les recdsterre systime 1 tempdeux We do an other sort : We have to do not remove rectangles which only have one common summit t1 systime 1 indice intarr nx ny trimask intarr nx ny trimask 0:nx 2 0:ny 2 1 IF recdsterre 0 NE 1 then BEGIN tempdeux systime 1 For key_performance 2 indice recdsterre 1 if NOT keyword_set basic then begin vire1 0 vire2 0 while vire1 0 NE 1 OR vire2 0 NE 1 ne 0 do begin Delete rectangles we have to remove from recsterre in fact those we have to keep although they ar eentirely in the land vire1 where indice shift indice 1 1 1 shift indice 0 1 1 shift indice 1 0 trimask EQ 1 if vire1 0 NE 1 THEN BEGIN indice vire1 0 indice vire1 nx 1 0 endif vire2 where 1 indice 1 shift indice 1 1 shift indice 0 1 shift indice 1 0 trimask EQ 1 if vire2 0 NE 1 THEN BEGIN indice vire2 1 0 indice vire2 nx 0 endif endwhile IF testvar var key_performance EQ 2 THEN print temps triangule: trier les recdsterre systime 1 tempdeux endif indice ny 1 1 The last column and the last line indice nx 1 1 can not define any rectangle tempdeux systime 1 For key_performance 2 recgarde where indice EQ 0 We recuperate numbers of triangles we will keep trigarde 2 recgarde recgarde nx trigarde transpose temporary trigarde trigarde trigarde trigarde 1 triang triang temporary trigarde IF testvar var key_performance EQ 2 THEN print temps triangule: virer les triangle de la liste systime 1 tempdeux endif endif print temps tri triangles systime 1 t1 When key_periodic equal 1 triang is a list of indexes s array which have a surplus column We have to put it back to the initial matrix by putting indexes of the last column equal to these of the last column tempdeux systime 1 For key_performance 2 if keyword_set key_periodic nx 1 EQ jpi AND NOT keyword_set basic then BEGIN indicey triang nx indicex triang indicey nx nx nx 1 liste where indicex EQ nx if liste 0 NE 1 then indicex liste 0 triang indicex nx indicey nx nx 1 if coinmont 0 NE 1 then begin indicey coinmont nx indicex coinmont indicey nx nx nx 1 liste where indicex EQ nx if liste 0 NE 1 THEN indicex liste 0 coinmont indicex nx indicey nx nx 1 endif if coindesc 0 NE 1 then begin indicey coindesc nx indicex coindesc indicey nx nx nx 1 liste where indicex EQ nx if liste 0 NE 1 THEN indicex liste 0 coindesc indicex nx indicey nx nx 1 endif endif IF testvar var key_performance EQ 2 THEN print temps triangule: finitions systime 1 tempdeux if keyword_set coinmonte THEN coinmonte coinmont ELSE twin_corners_up coinmont if keyword_set coindescend THEN coindescend coindesc ELSE twin_corners_dn coindesc IF NOT keyword_set key_forgetold THEN BEGIN updateold ENDIF IF keyword_set key_performance THEN print temps triangule systime 1 tempsun return triang END "); 339 339 a[337] = new Array("./ToBeReviewed/TRIANGULATION/triangule_e.html", "triangule_e.pro", "", " file_comments Build the triangulation for a E grid type categories Graphics param MASKENTREE in optional type 2d array It is a 2d array which will serve to mask the field we will trace after with CONTOUR TRIANGULATION triangule mask If this argument is not specified the function use tmask keyword BASIC Specify that the mask is on a basic grid use the triangulation for vertical cuts and hovmoellers keyword COINMONTE type array To obtain the array of ascending land corner to be treated with completecointerre pro in the variable array instead of make it pass by the global variable twin_corners_up keyword COINDESCEND type array See COINMONTE keyword SHIFTED uses common pro history Sebastien Masson smasson lodyc jussieu fr june 2001 version Id: triangule_e pro 163 2006 08 29 12:59:46Z navarro todo seb L 152 153 je ne pense pas que ce soit ce que tu voulais dire mais c est la traduction de ce qu il y avait crit Correction si besoin FUNCTION triangule_e maskentree COINMONTE coinmonte COINDESCEND coindescend SHIFTED shifted BASIC basic compile_opt idl2 strictarrsubs cm_4mesh IF NOT keyword_set key_forgetold THEN BEGIN updatenew ENDIF tempsun systime 1 For key_performance Is the mask given or do we have to take tmask msk maskentree sizem size msk nx sizem 1 ny sizem 2 if keyword_set key_periodic nx EQ jpi AND NOT keyword_set basic then BEGIN msk msk msk 0 nx nx 1 ENDIF we will find the diamond that must be cut in two triangle using the horizontal diagonal index lindgen nx ny index index 0:nx 2 1:ny 2 if n_elements shifted EQ 0 then shifted 1 oddeven index nx 1 shifted MOD 2 msk1 msk index msk2 msk index 1 sum msk index nx oddeven msk index nx oddeven sum1 msk2 sum sum2 msk1 sum horizontal singularpoint where msk1 EQ 0 AND sum1 EQ 3 OR msk1 EQ 1 AND sum1 EQ 0 OR msk2 EQ 0 AND sum2 EQ 3 OR msk2 EQ 1 AND sum2 EQ 0 OR sum EQ 0 AND msk1 msk2 EQ 2 if singularpoint 0 NE 1 then begin horizontal index singularpoint triang definetri_e nx ny horizontal SHIFTED shifted ENDIF ELSE triang definetri_e nx ny SHIFTED shifted coinmont index where sum EQ 2 AND msk1 msk2 EQ 0 coindesc index where sum EQ 0 AND msk1 msk2 EQ 2 we keep only the triangles which are outside the land but for some reasons we will in fact delete the land diamond allrecinland where sum1 msk1 EQ 0 indexallinland index allrecinland otherrec lindgen nx ny 0:nx 2 1:ny 2 otherrec different otherrec indexallinland index lindgen nx ny index index 0:nx 3 2:ny 3 out inter index indexallinland IF out 0 NE 1 THEN begin out inter out 1 indexallinland IF out 0 NE 1 THEN begin out out 1 oddeven out nx 1 shifted MOD 2 out inter out nx oddeven otherrec IF out 0 NE 1 THEN begin out inter out 2 nx otherrec IF out 0 NE 1 THEN begin out out nx out nx shifted MOD 2 endif endif endif ENDIF help out index lindgen nx ny index index 0:nx 3 2:ny 3 out inter index otherrec IF out 0 NE 1 THEN begin out inter out 1 otherrec IF out 0 NE 1 THEN begin out out 1 oddeven out nx 1 shifted MOD 2 out inter out nx oddeven indexallinland IF out 0 NE 1 THEN begin out inter out 2 nx indexallinland IF out 0 NE 1 THEN begin out out nx out nx shifted MOD 2 endif endif endif endif help out IF out 0 EQ 1 THEN out different indexallinland out ELSE out indexallinland triout numtri out nx ny triout triout triout 1 goodtri lindgen 2 nx 1 ny 1 goodtri different goodtri triout triang triang temporary goodtri When key_periodic equal 1 triang is a list of indexes s array which have a surplus column We have to put it back to the initial matrix by putting indexes of the last column equal to these of the last column tempdeux systime 1 For key_performance 2 if keyword_set key_periodic nx 1 EQ jpi AND NOT keyword_set basic then BEGIN indicey triang nx indicex triang indicey nx nx nx 1 liste where indicex EQ nx if liste 0 NE 1 then indicex liste 0 triang indicex nx indicey nx nx 1 if coinmont 0 NE 1 then begin indicey coinmont nx indicex coinmont indicey nx nx nx 1 liste where indicex EQ nx if liste 0 NE 1 THEN indicex liste 0 coinmont indicex nx indicey nx nx 1 endif if coindesc 0 NE 1 then begin indicey coindesc nx indicex coindesc indicey nx nx nx 1 liste where indicex EQ nx if liste 0 NE 1 THEN indicex liste 0 coindesc indicex nx indicey nx nx 1 endif endif IF testvar var key_performance EQ 2 THEN print temps triangule: finitions systime 1 tempdeux if arg_present coinmonte THEN coinmonte coinmont ELSE twin_corners_up coinmont if arg_present coindescend THEN coindescend coindesc ELSE twin_corners_dn coindesc IF NOT keyword_set key_forgetold THEN BEGIN updateold ENDIF IF keyword_set key_performance THEN print temps triangule systime 1 tempsun return triang END ");
Note: See TracChangeset
for help on using the changeset viewer.